[ale] Private members in perl
Chris Fowler
cfowler at outpostsentinel.com
Sun Aug 1 16:58:18 EDT 2004
I'm trying to figure a way to implement private members in perl objects
but all the text I'm reading has me confused
--- Object---
{
package OBJ;
use strict;
sub AUTOLOAD {
my $self = shift;
print "AUTOLOAD\n";
}
sub new {
shift;
#
# Make sure the type specified is
# supported
my $con = {
'S' => 1,
};
bless $con, 'OBJ'; # Tag object with pkg name
return $con; # Return object
}
}
return 1;
--- Program ----
#!/opt/SAM/perl/bin/perl
use OBJ;
my $o = OBJ->new();
print $o->{'S'} ;
Can someone tell me how to make the 'S' private and not accessible?
Thanks,
Chris
More information about the Ale
mailing list