in reply to Re: localizing lexical without messing with tie ?
in thread localizing lexical without messing with tie ?
argh you're right, I didn't test what I didn't expect... I would explicitly need to untie the localized var.
package NewStdScalar; require Tie::Scalar; @ISA = qw(Tie::StdScalar); sub FETCH { return ${+shift}++ } package main; $\="\n"; $,="\t"; tie our $scalar, 'NewStdScalar'; sub prsc {print $scalar }; $scalar=0; prsc(); { local $scalar=42; # untie $scalar; # uncomment this to make it work prsc(); prsc(); prsc(); print $scalar; } prsc(); __DATA__ 0 42 43 44 45 1
Sorry, ATM I'm too tired to look further into the examples you posted, later more.
But I think I will go the simple way to exclude the use of tied variables by throwing a warning. Thx,
Cheers Rolf
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: localizing lexical without messing with tie ?
by ikegami (Patriarch) on Sep 08, 2010 at 17:01 UTC | |
by LanX (Saint) on Sep 08, 2010 at 17:53 UTC | |
by ikegami (Patriarch) on Sep 09, 2010 at 03:03 UTC | |
by LanX (Saint) on Sep 09, 2010 at 11:31 UTC | |
by ikegami (Patriarch) on Sep 10, 2010 at 01:50 UTC | |
|