|
|
|
good chemistry is complicated, and a little bit messy -LW |
|
| PerlMonks |
Re^2: Prevent direct acces to object's attributesby vitoco (Pilgrim) |
| on Sep 07, 2009 at 18:19 UTC ( #794002=note: print w/ replies, xml ) | Need Help?? |
|
Why do you want to prevent access to object values using $obj->{...}? Maybe you want to educate your project members to not do that? Reading directly from attributes is not a real problem, but writing is, because there are some interdependencies between attributes: some of them are preprocessed values based on other ones (like a cache), and changing them would produce unexpected behavior on some methods. Of course, that is mentioned in the POD, but then I thought I missed something from the docs. I'm new in writing OO code... Now, Moose and InsideOut objects are in my queue for further reading, just after Damian Conway's book! Thanks to everyone...
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||