in reply to Re^5: Lexical::Alias & subroutines
in thread Lexical::Alias & subroutines
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Lexical::Alias & subroutines
by Aristotle (Chancellor) on May 21, 2003 at 13:24 UTC |