http://www.perlmonks.org?node_id=605164


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

-xdg

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.