in reply to Prevent direct acces to object's attributes
A common convention that is used to reinforce this "social engineering" aspect of perl 5's OO is to prefix your "internal" variable names with an underscore character ("_atr1", "_atr2", etc).
If you don't have Damian Conway's fine book, Objected Oriented Perl, you should get a copy. Chapter 11, "Encapsulation", explains what you need to know and do to use closures inside your classes so that direct access is effectively ruled out. I'm no expert on this myself, and it would take me a while to demonstrate -- perhaps another monk will step in...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Prevent direct acces to object's attributes
by almut (Canon) on Sep 07, 2009 at 17:29 UTC | |
by CountZero (Bishop) on Sep 07, 2009 at 20:27 UTC |