How about:
use strict; package M; sub x { my $caller_package = shift; print "Caller: $caller_package\n"; $caller_package->_x(); } package main; sub _x { my $class = shift; print "$class _x\n"; } main->M::x();
output:
Caller: main main _x
update: added "shift" in _x - thanks ikegami.
In reply to Re: Getting module to call importer's function
by fglock
in thread Getting module to call importer's function
by jredburn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |