LanX has asked for the wisdom of the Perl Monks concerning the following question:
(caller(0))[3] shows me the name of the currently executed function.
But in case of importing/aliasing it'll be the original one not the alias' name.
Any way to find the name of the alias?
details:
$\="\n"; sub show { print join "\t",(caller(0))[0..3]; }; show(); *func = \&show; func();
prints
/usr/bin/perl -w /tmp/tst.pl main /tmp/tst.pl 6 main::show main /tmp/tst.pl 10 main::show
any straight forward way to get "main::func" in the second case?
(no, parsing the calling line is not an option)
Thankses for your attention! :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Name of caller if aliased?
by Discipulus (Canon) on Feb 25, 2015 at 09:25 UTC | |
by LanX (Saint) on Feb 25, 2015 at 14:11 UTC | |
|
Re: Name of caller if aliased?
by Mr. Muskrat (Canon) on Feb 25, 2015 at 20:29 UTC | |
by LanX (Saint) on Feb 25, 2015 at 22:43 UTC | |
by Mr. Muskrat (Canon) on Feb 25, 2015 at 23:04 UTC | |
|
Re: Name of caller if aliased?
by Anonymous Monk on Feb 25, 2015 at 08:22 UTC | |
by LanX (Saint) on Feb 25, 2015 at 14:37 UTC |