|
|
| Welcome to the Monastery | |
| PerlMonks |
Re: Changing Local Variable Out of Context (updated)by LanX (Saint) |
| on Jun 13, 2023 at 13:30 UTC ( [id://11152834]=note: print w/replies, xml ) | Need Help?? |
|
> Is it even possible? Yes, with PadWalker it's possible to mess with such internals. See demo. But as Toby already said, it's probably not a good idea especially for production code. NB: After calling your patched sub, you'll change $varry for it's whole (file?) scope in that module. This can lead to very unfortunate side effects, if carelessly done.
UPDATEchanged code to better demonstrate side effects on $varry
Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||