in reply to Defining a function in the caller's package
package Foo; sub do_something { print scalar caller, "\n"; } sub import { my $target = caller; no strict 'refs'; *{"$target:\:do_something"} = \&do_something; } 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Defining a function in the caller's package
by rovf (Priest) on Aug 11, 2008 at 12:41 UTC | |
by mr_mischief (Monsignor) on Aug 11, 2008 at 16:10 UTC | |
by rovf (Priest) on Aug 12, 2008 at 08:19 UTC |