in reply to Accessing a lexical variable of another file.
PadWalker can only help here if you know at least one function using var from the outer scope( see closed_over() )
Sounds very fragile.
Theoretically you could dive into B and try to localize $var from the OP tree but that's a maintenance nightmare.
If its your module just export
this doesn't confuse the ref count and is the cleanest approach.our $varref=\$var
Update: and if you love source filter hacking you could require manually, that is find the module, read the text, append the above line and eval all.
Interesting discussion, though that was most likely an XY Problem... :)
HTH
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
PS: I even doubt you can retrieve the ref of a var using B , but I'd love to know.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Accessing a lexical variable of another file.
by Superfox il Volpone (Sexton) on Sep 10, 2014 at 13:54 UTC | |
by clueless newbie (Curate) on Sep 10, 2014 at 14:23 UTC | |
by LanX (Saint) on Sep 10, 2014 at 15:03 UTC | |
by clueless newbie (Curate) on Sep 10, 2014 at 18:07 UTC | |
by LanX (Saint) on Sep 10, 2014 at 18:27 UTC | |
by Superfox il Volpone (Sexton) on Sep 10, 2014 at 15:51 UTC |