>On 11/27/10 12:36 PM, Rafael Garcia-Suarez wrote: >>> I expect STDERR to be delocalized before final exeption handling kicks in. >>> It's as if the lexical scope isn't being left. >> >> Not a bug, in my opinion (local() being dynamic scoping, not lexical scoping). > Yes, the effect on STDERR is dynamic, but that dynamic effect should be <SNIP> > undone as part of leaving that lexical scope. But it *hasn't* left that scope: % perl -d /tmp/e [./.perldb] setting stdout to autoflush Die handler removed. warn set to 0, die set to 0 Loading DB routines from perl5db.pl version 1.32 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(/tmp/e:12): bar(); DB<1> l 1-20 1 sub foo { 2: die q<why doesn't this show up?>; 3 } 4 5 sub bar { 6: my $x; 7: open my $h, '>', \$x; 8: local *STDERR = $h; 9: foo(); 10 } 11 12==> bar(); DB<2> b 2 DB<3> c main::foo(/tmp/e:2): die q<why doesn't this show up?>; DB<3> T . = main::foo() called from file `/tmp/e' line 9 . = main::bar() called from file `/tmp/e' line 12 DB<3> It is still within scope. --tomThread Previous | Thread Next