Definitely no. If I did
and someone else in the Module writessub foo { local $SWAP = 1; alias $alias => $original; ... Module::bar(some,params); ... }
And suddenly his/her code starts trying to do something else than it should. Just because it was called from my foo() instead of directly. The local() could only "help" if I used it like this:sub bar { alias $original => $alias; ... }
But that's to long. I'd need the $SWAP to be lexical to my whole file, not local to the current call/block stack.sub foo { {local $SWAP = 1;alias $alias => $original;} ... }
I think the nicest solution is alias $original => $alias; and Alias $alias => $original;.
Or maybe I should just learn it's the other way around versus what I'd expect :-)
Jenda
Always code as if the guy who ends up maintaining your code
will be a violent psychopath who knows where you live.
-- Rick Osborne
Edit by castaway: Closed small tag in signature
In reply to Re: Re^5: Lexical::Alias & subroutines
by Jenda
in thread Lexical::Alias & subroutines
by Jenda
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |