in reply to Re^2: Stashing a Package Variable by Reference
in thread Stashing a Package Variable by Reference
But if I understand correctly, you're setting up a hash in the stasher's symbol table. Since my case isn't really a script, that's not main ...
Not really sure what you mean. Of course, the approach isn't limited to main — the latter is just the top-level stash that every "package path" is rooted at.
Essentially, all I wanted to point out is that, in general
${ $::{'PackageA::'}{'PackageB::'}{'PackageC::'}{foo} }
functionally achieves the same as your symbolic reference
${ *{"PackageA::PackageB::PackageC::foo"} }
(which could be simplified to ${"PackageA::PackageB::PackageC::foo"}, btw — or ${"$ns\::foo"} in your specific case)
But, as the former approach doesn't involve symbolic references, it's compatible with use strict, i.e. it doesn't need no strict 'refs'.
P.S.: in several places of the current version of your original node, you're missing the closing curly in the expression ${ *{"${ns}\::foo"}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Stashing a Package Variable by Reference
by Xiong (Hermit) on May 31, 2010 at 20:27 UTC | |
by almut (Canon) on May 31, 2010 at 21:32 UTC | |
by ikegami (Patriarch) on May 31, 2010 at 20:38 UTC | |
|
Re^4: Stashing a Package Variable by Reference
by bart (Canon) on May 31, 2010 at 20:39 UTC | |
by almut (Canon) on May 31, 2010 at 22:16 UTC | |
by bart (Canon) on Jun 01, 2010 at 09:25 UTC | |
by almut (Canon) on Jun 01, 2010 at 09:42 UTC |