or# private method add my $add = sub { my $self = shift; my $amount = shift; $self->balance($self->balance+$amount); };
# private method padd sub padd { my $self = shift; my $amount = shift; caller(0) eq __PACKAGE__ || die "private method"; print caller(0) . " " . __PACKAGE__; $self->balance($self->balance+$amount); }
In reply to OO - best way to have protected methods by gargle
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |