Realbot has asked for the wisdom of the Perl Monks concerning the following question:
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();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: __PACKAGE__ and method reference
by borisz (Canon) on Mar 09, 2005 at 13:36 UTC | |
by Realbot (Scribe) on Mar 09, 2005 at 13:46 UTC | |
|
Re: __PACKAGE__ and method reference
by PodMaster (Abbot) on Mar 09, 2005 at 13:41 UTC | |
|
Re: __PACKAGE__ and method reference
by chromatic (Archbishop) on Mar 09, 2005 at 17:25 UTC |