[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] Private members in perl
- Subject: [ale] Private members in perl
- From: cfowler at outpostsentinel.com (Chris Fowler)
- Date: Sun Aug 1 16:58:18 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