
perlbug-followup at perl
Apr 28, 2012, 2:19 PM
Post #3 of 3
(46 views)
Permalink
|
|
[perl #16235] local($^W) does not work correctly
[In reply to]
|
|
On Sat Apr 28 13:56:58 2012, sprout wrote: > On Sat Apr 28 02:11:01 2012, Hugmeir wrote: > > On Tue Jul 15 23:16:04 2003, schwern wrote: > > > Confirmed in 5.8.0 and 5.8.1 RC2. > > > > This is still present in 5.14.2 and blead, but a small update: The > > original bug report says that Solaris behaved differently, > > Knowing how this is implemented, I think it was misdiagnosed. > > > failing on > > the final die. Now it's the same same place as Linux/Windows, on > > > > { local($^W) = $^W; > > die "BUG: warn is off5" unless $^W; > > } > > Usually, local($foo) creates a new $foo in *foo{SCALAR}, copies the > magic to it, and then calls set-magic on it. This allows a plain > local($^W); to work. > > local($foo) = $foo works because the $foo on the RHS (which is executed > first) is the original $foo; i.e., a completely different scalar. > > For magical variables things gang agley, because the local($^W) on the > LHS is a separate operator from assignment and sets $^W to undef befor > the assignment happens. Since both $^W’s have magic that writes to the > same underlying structures, the assignment has no affect. I forgot to mention that local($hash{elem}) in lvalue context is special-cased to work, for the sake of %SIG. There are various /* XXX - FIXME - see #60360 */ comments sprinkled here and there. -- Father Chrysostomos --- via perlbug: queue: perl5 status: open https://rt.perl.org:443/rt3/Ticket/Display.html?id=16235
|