- or download this
sub _private_sub {
die "_private_sub is private!" unless caller eq __PACKAGE__;
# private stuff #
}
- or download this
sub PROTECTED {
my $self = shift;
...
return $self;
}
- or download this
use base 'BaseClass';
# some stuff #
...
my $self = shift->PROTECTED;
print "This is a protected sub!";
}
- or download this
method 'test2' is protected by 'LocalTest' at LocalTest.pm line 12
LocalTest::test2('LocalTest2=HASH(0x18633a4)') called at test.
+pl line 15
main::test() called at test.pl line 20