> STDERR isn't being unlocalized when there's an unhandled exception. For > example, > > perl -E 'open my $h, ">", \$string; local *STDERR = $h; die "blah"' > > doesn't emit anything. That's global scope you say? The following shows the > same problem: > > sub foo { > die q<why doesn't this show up?>; > } > > sub bar { > my $x; > open my $h, '>', \$x; > local *STDERR = $h; > foo(); > } > > bar(); > > I expect STDERR to be delocalized before final exeption handling kicks in. *There simply is no final exception handling*. If die can't find an eval block in an outer scope it defaults to printing out the error and exit()ing. This is documented in perlfunc#die. The stack being pop()ed is only a consequence of that exit. Hence, the warning is being written before the unpopping of the stack. I agree it may be better to do final exception handling, but the current behavior is correct in the sense that it works as advertised. LeonThread Previous | Thread Next