http://www.perlmonks.org?node_id=484432

gargle has asked for the wisdom of the Perl Monks concerning the following question:

I often use one of the following constructs for my private methods. Both have their benefits (the first gives a compile error, the second one dies during runtime but is easier to read). However, I wonder if there are other, better ways?
# private method add my $add = sub { my $self = shift; my $amount = shift; $self->balance($self->balance+$amount); };
or
# 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); }