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 02:10
Subject:
Re: A user pragma example
Message ID:
20060401100953.GH32132@plum.flirble.org
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)

Given the amount of redundancy in all this flag setting/hash creation/
tree building, I keep thinking that something can be eliminated and
some simplification achieved.

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