in reply to Re^2: PadWalker's closed_over - but for our variables?
in thread PadWalker's closed_over - but for our variables?
our variables are lexical package variables. "Lexical" describes the scope not how they are stored (private vs package)
I'm not sure I agree. At least in my mind, package variables are quite different from lexical variables: package variables are stored in the symbol table (and they can be inspected and manipulated there) and lexical variables in the pads (which aren't so easy to inspect, hence PadWalker). All that our does is create an alias to a package variable, that that alias happens to be lexical in scope is the only "lexical" thing about it, I think. Anyway:
I need to introspect a coderef for the package vars used inside, you are right that it might not matter if they were declared outside with our.
At the moment I'm not aware of an easy solution. Any general-purpose solution would fail in the presence of no strict, since I could write no strict; ${"${x}::${y}"} = "hello"; or even ${"a".int(rand(999))} and you'd never know which package variable I just accesed. Perhaps something PPI-based...? I don't have any other good ideas at the moment, perhaps inspiration will strike later.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: PadWalker's closed_over - but for our variables?
by ikegami (Patriarch) on Apr 04, 2021 at 05:38 UTC | |
by LanX (Saint) on Apr 05, 2021 at 15:37 UTC | |
by ikegami (Patriarch) on Apr 05, 2021 at 21:59 UTC | |
by LanX (Saint) on Apr 05, 2021 at 22:01 UTC | |
by ikegami (Patriarch) on Apr 05, 2021 at 22:06 UTC | |
| |
Re^4: PadWalker's closed_over - but for our variables?
by LanX (Saint) on Apr 03, 2021 at 16:55 UTC | |
by haukex (Archbishop) on Apr 03, 2021 at 17:09 UTC | |
by LanX (Saint) on Apr 03, 2021 at 18:19 UTC |