package Very::Long::Name; sub new { my $self = {}; bless($self); return $self; } sub foo { return "hello\n"; } sub bar { my ($self, $subref) = @_; return $self->$subref(); } sub foobar { my $self = shift; return $self->bar(\&Very::Long::Name::foo); # return $self->bar(\&__PACKAGE__::foo); # this gives me error } package Main; my $obj = Very::Long::Name->new(); print $obj->foobar();
In reply to __PACKAGE__ and method reference by Realbot
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |