perl5ever has asked for the wisdom of the Perl Monks concerning the following question:
Example:
When this code is executed, the call hello() will try to call main::hello. However, is it possible to put some magic in foo so that the function call hello() will be resolved as a call to other::hello()?package other; sub hello { ... } package main; sub foo { # some magic here to make hello -> other::hello? $_[0]->(); } foo(sub { hello() });
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: localizing __PACKAGE__?
by Corion (Patriarch) on Feb 25, 2011 at 23:56 UTC | |
Re: localizing __PACKAGE__?
by JavaFan (Canon) on Feb 26, 2011 at 12:41 UTC | |
Re: localizing __PACKAGE__?
by TomDLux (Vicar) on Feb 26, 2011 at 01:24 UTC |