Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Perl: porters

[perl #16235] local($^W) does not work correctly

 

 

Perl porters RSS feed   Index | Next | Previous | View Threaded


perlbug-followup at perl

Apr 28, 2012, 1:56 PM

Post #1 of 3 (43 views)
Permalink
[perl #16235] local($^W) does not work correctly

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.

This is similar to bug #104118, but a little different; but I think it’s
the same code that would need adjustment.

--

Father Chrysostomos


---
via perlbug: queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=16235


perlbug-followup at perl

Apr 28, 2012, 2:11 AM

Post #2 of 3 (40 views)
Permalink
[perl #16235] local($^W) does not work correctly [In reply to]

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, 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;
}


---
via perlbug: queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=16235


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

Perl porters RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.