in reply to Re^2: Defining a function in the caller's package
in thread Defining a function in the caller's package
package ForeignModule; sub NEXT { print scalar caller } 1;
package Foo; # there is no do_something sub import { my $target = caller; no strict 'refs'; *{"$target:\:do_something"} = \&ForeignModule::NEXT; } 1;
package main; use strict; use warnings; use Foo; do_something();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Defining a function in the caller's package
by rovf (Priest) on Aug 12, 2008 at 08:19 UTC |