laziness, impatience, and hubris | |
PerlMonks |
Re: Deferring variablesby LanX (Saint) |
on Jun 25, 2022 at 21:25 UTC ( [id://11145045]=note: print w/replies, xml ) | Need Help?? |
Sorry, I initially misunderstood your question, but reading some other replies helped. (my main processor is (st)ill suffering from a virus attack ;-) I tried aliasing, but no joy, after the first level you have far too much trouble maintaining. I tried refs on hash elements, it worked but was a bit too fickle, if the data structure changed. I tried just one data structure, denoting the links with special values like \"margin" , but again too much trouble maintaining such a mangled structure. My suggestion is to keep it simple, an additional hash %def maps to the default and you use a simple recursive get-function.
please note that I also preferred undef over "a" Otherwise you can easily change the get code with a ternary $par{$key} ne "a" ? $par{$key} : get( $def{$key} );
Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|