develooper Front page | perl.perl5.porters | Postings from April 2006

Re: A user pragma example

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
April 1, 2006 13:20
Subject:
Re: A user pragma example
Message ID:
20060401212030.GU32132@plum.flirble.org
On Sat, Apr 01, 2006 at 11:09:53AM +0100, Nicholas Clark wrote:
> On Sat, Apr 01, 2006 at 01:22:17AM +0200, Rafael Garcia-Suarez wrote:
> > On 4/1/06, Rafael Garcia-Suarez <rgarciasuarez@gmail.com> wrote:
> > > sub import {
> > >     $^H{mypragma} = 1;
> > > }
> > 
> > Correction : You need this in import() too :
> >    $^H |= 0x00020000;
> > this makes perl properly restore %^H at scope exit during compilation.
> > 
> > Although without this line, my test file still works.
> > If you add at the end of the test file :
> > BEGIN { print $^H{mypragma} }
> > you'll see that $^H{mypragma} wasn't restored there.
> 
> I think we may be able to avoid the need to do that.
> Given that all writes/deletes to %^H are spotted, I think we could add code
> to set that bit whenever %^H is modified. (And the bit is cleared at
> scope exit at the point that the previous %^H is restored)

Change 27666 sets HINT_LOCALIZE_HH whenever %^H is modified.
It took a lot of digging to get it working.

Nicholas Clark

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About