in reply to Re: Perl OO newbie advice - object interaction
in thread Perl OO newbie advice - object interaction
Internal data you can edit directly. An Object in perl is internally a hash. $object->{_member} will give you the value. Perl doesn't support data hiding as it is not a pure Object Oriented Language. But you can still aviod this kind of attach by using InsideOut ObjectThat collection of statements contains the barest shreds of truth.
Perl objects do not have a defined form. Blessed hashes are merely the most frequently used form, but the only thing consistent about objects in Perl is that they are blessed references. The reference might well lead you nowhere (as in Inside Out Objects).
Data hiding is quite possible, but you need to do something other than blessed hashes. Inside Out Objects permit data to be hidden such that nothing outside the defining package can touch it directly. In fact, you can even set tighter bounds on it, such that the state can only be accessed through methods, even within the package.
I recommend Conway, Object Oriented Perl, as a fairly comprehensive look at the different ways you can do OO in Perl. It can expand your horizons tremendously.
|
|---|