Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

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

by xdg (Monsignor)
on Mar 16, 2007 at 15:02 UTC ( #605164=note: print w/replies, xml ) Need Help??

in reply to Re^2: RFR: Inside-out classes - a Class::InsideOut primer
in thread RFR: Inside-out classes - a Class::InsideOut primer

Class::InsideOut does require the developer to consider whether one's attributes are public, private, or read-only

Well, perhaps it's clearer to say that Class::InsideOut emphasizes the decision through a choice of syntax.

Class::InsideOut tries to require as few things as possible:

  1. Objects: All new objects must be passed to (or created by) the register() function
  2. Properties: All data structures for object properties must be passed to the property() function.
  3. Direct Access: The key to directly access the property for an object in a property hash must be generated using refaddr() (from Scalar::Util) or the shorter alias id().

The public(), private() and readonly() functions just call property() with appropriate options.

I agree that showing it in practice rather than explaining all this is more appropriate for a primer


Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://605164]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2018-01-19 16:01 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (221 votes). Check out past polls.