I found a serious limitation in PadWalker and I'm not optimistic this can be resolved easily.
var_name() seems to fail if the originating context of the lexical variable was a string eval
use strict; use warnings; use Data::Dump qw(pp dd); use PadWalker qw/var_name/; sub _ { return var_name(1, \$_[0] ) => $_[0] } sub t_ { _ my $xxx=666 } dd [ t_ ]; # works: ["\$xxx", 666] dd [ _ my $xxx=666 ]; # works: ["\$xxx", 666] dd [ eval '_ my $xxx=666' ]; # fails: [undef, 666]
The module is called PadWalker and seems eval doesn't use a "pad" for lexicals (?)
This limitation isn't listed in the docs (no mention of eval at all).
Or am I missing something?
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!
In reply to PadWalker::var_name BUG? by LanX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |