in reply to Detect a localized variable
I want My::Cache to complain (and refuse to force refreshing) if someone starts modifying the variable without using local.
Um, no you don't, that sounds like horrible API design :)
$ perl use Devel::Peek; use Scalar::Util qw' refaddr '; our $snot = 66; Dump $snot; warn refaddr \$snot; local $snot = 77; Dump $snot; warn refaddr \$snot; __END__ SV = IV(0x99acf8) at 0x99acfc REFCNT = 1 FLAGS = (IOK,pIOK) IV = 66 10071292 at - line 5. SV = IV(0x3f8c58) at 0x3f8c5c REFCNT = 1 FLAGS = (IOK,pIOK) IV = 77 4164700 at - line 8. $ perl -le " print 0x3f8c5c 4164700 $ perl -le " print 0x99acfc 10071292
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Detect a localized variable
by Anonymous Monk on Nov 18, 2011 at 13:47 UTC | |
by Sewi (Friar) on Nov 18, 2011 at 14:01 UTC | |
|
Re^2: Detect a localized variable
by Sewi (Friar) on Nov 18, 2011 at 13:58 UTC |