[ale] Private members in perl

Fletch fletch at phydeaux.org
Sun Aug 1 18:51:46 EDT 2004


>>>>> "Chris" == Chris Fowler <cfowler at outpostsentinel.com> writes:

    Chris> I'm trying to figure a way to implement private members in
    Chris> perl objects but all the text I'm reading has me confused

The followup you posted (using a closure as your instance) is one way;
using something like Tie::SecureHash rather than a plain hashref is
another.  In general Perl relies on convention rather than enforcement
in matters of encapsulation.  You don't muck around with an object's
insides unless you do so according to a published interface; if you
decide to do so you do it with the knowledge that any breakage caused
by doing so is your fault.

-- 
Fletch                | "If you find my answers frightening,       __`'/|
fletch at phydeaux.org   |  Vincent, you should cease askin'          \ o.O'
                      |  scary questions." -- Jules                =(___)=
                      |                                               U



More information about the Ale mailing list