develooper Front page | perl.perl5.porters | Postings from September 2010

[PATCH] Re: [perl #77684] Opening references to glob copies

Thread Next
From:
Father Chrysostomos
Date:
September 5, 2010 13:12
Subject:
[PATCH] Re: [perl #77684] Opening references to glob copies
Message ID:
FB62A04D-D431-4A16-A243-33F0C12470D0@cpan.org

On Sep 5, 2010, at 1:01 PM, Father Chrysostomos wrote:

> This is a regression introduced in the past week by yours truly, with change 10cea945821.
> 
> $ perl5.13.4 -le '$a = *foo; open $fh, ">", \$a; print $fh, "b"; print $a'
> b
> $ bleadperl -le '$a = *foo; open $fh, ">", \$a; print $fh, "b"; print $a'
> *main::foo
> $ ls
> GLOB(0x8017b8)
> 
> bleadperl behaves the same way a 5.8.x. It seems it was changed unintentionally in 5.10.0. In any case, the 5.10/12 behaviour is less surprising and more useful.
> 
> Note that I am only talking about copies of globs here, that is, globs with the FAKE flag on. (That was why I said ‘real globs’ in the commit message for 10cea945821, but I forgot regenerate the patch after updating my working copy.)

Here is a patch to fix this. Note that this also affects \*$glob_copy, which is controversial, but at least I am only restoring the 5.10/12 behaviour in this case. (I think ideally that an explicit * should do a SvFAKE_off temporarily [effectively], but in this case the result has no practical application, so it’s not worth the time.)

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