![]() |
![]()
| ![]() |
![]()
NAMEprivate - Add private data members to Perl classes SYNOPSISpackage GI::Joe; use private qw( _SexualPrefs _IsSpy ); # see the protected man page for an example DESCRIPTION
private.pm adds a list of keys as private data members to the current class. See public for more info. Private data members are those pieces of data which are expected to be only accessed by methods of the class which owns them. They are not inherited by subclasses. private.pm serves a subset of the functionality of fields.pm. use private qw(_Foo); is almost exactly the same as: use fields qw(_Foo); with the exception that you can (if you REALLY want to) do something like this: use private qw(Foo); Whereas one cannot do this with fields.pm. (Note: This is considered unwise and private.pm will scream about it if you have Perl's warnings on.) Additionally, private.pm is a bit clearer in its intent and is not necessarily implying use of pseudo-hashes. EXAMPLESSee "SYNOPSIS" in protected for an example of use. MUSINGSI fully expect private.pm to eventually mutate into a real pragma someday when a better formalized OO data system for Perl supplants the current fledgling pseudo-hashes. AUTHORMichae G Schwern <schwern@pobox.com> SEE ALSOpublic, protected, fields, base, Class::Fields
|