in reply to Re^8: localizing lexical without messing with tie ?
in thread localizing lexical without messing with tie ?
it's intended to allow an unlimited number of vars
Arguments do allow that. It seems that what you want is named arguments. Maybe you should use Sub::Parameters or something like that.
You're striving for the awkward
but the following is clearer:my $c; thing { ... ... $c ... ... } $c;
thing { my $c : Parameter; ... ... $c ... ... };
and as a side note $a and $b could be tied too.
So? I've already shown you how to completely localise a package variable.
The advantage of $a, $b and $_ is that you don't need to declare them.
As I said, forbidding tied vars is a good and pragmatic solution to get around this edge case.
There are a lot more magic variables than just tied ones, but you're not likely to find them on lexicals without putting it on them explicitly.
You'll also clobber dualvars and vars' pos().
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^10: localizing lexical without messing with tie ?
by LanX (Saint) on Sep 10, 2010 at 21:11 UTC | |
by ikegami (Patriarch) on Sep 11, 2010 at 02:11 UTC | |
by LanX (Saint) on Sep 11, 2010 at 12:57 UTC | |
by ikegami (Patriarch) on Sep 11, 2010 at 14:40 UTC | |
by LanX (Saint) on Sep 12, 2010 at 13:04 UTC | |
|