LanX has asked for the wisdom of the Perl Monks concerning the following question:
it's possible to use PadWalker::var_name( LEVEL, VAR_REF ) to get the original name of a reference in the callers scope.
Question: can I use the B back-end to achieve the same by calling methods with pure Perl (aka without dependency to a° XS module)?
ehm ... turns out the monastery is my virtual rubber duck
B::Xref is in pure Perl and is capable to inspect the lexicals of a sub. So the answer should be yes, provided I'm able to compare the refs too.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
°) non-core
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Getting name of a lexical variable without PadWalker?
by dave_the_m (Monsignor) on Jul 15, 2020 at 21:10 UTC | |
by LanX (Saint) on Jul 15, 2020 at 21:38 UTC | |
by LanX (Saint) on Jul 16, 2020 at 15:40 UTC |