Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Welcome to the Monastery
 
PerlMonks  

Re: RFR: Inside-out classes - a Class::InsideOut primer

by rvosa (Curate)
on Mar 17, 2007 at 16:23 UTC ( #605283=note: print w/ replies, xml ) Need Help??


in reply to RFR: Inside-out classes - a Class::InsideOut primer

Great tutorial! I have to say, I am also an avid user of inside-out objects - but I agree with others that it's more an inheritance thing than a typo thing. If it was only about the typo issue you could also use locked hashes (well, erm...) or using array refs with constants as indices or something.

I don't know if you feel like adding it, but there are also some problems with inside-out objects (in general, not with Class::InsideOut, I mean): you have to be more careful about cleanup of the instance data when objects go out of scope, and sometimes it's nice if you can run a hash object through Data::Dumper to debug it.

And the privacy is still relative - I'm not sure how things work under the hood, but wouldn't you be able to step into the package namespace from elsewhere and clobber the hashes holding the instance data?


Comment on Re: RFR: Inside-out classes - a Class::InsideOut primer
Re^2: RFR: Inside-out classes - a Class::InsideOut primer
by Anno (Deacon) on Mar 17, 2007 at 23:19 UTC
    And the privacy is still relative - I'm not sure how things work under the hood, but wouldn't you be able to step into the package namespace from elsewhere and clobber the hashes holding the instance data?

    Not if you use lexical hashes for data storage as is usually recommended. Excluding padwalker trickery, those are only accessible from their lexical scope, which can be made sufficiently small.

    Anno

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://605283]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2014-04-17 07:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (440 votes), past polls