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

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

Thread Next
Father Chrysostomos
September 5, 2010 13:12
[PATCH] Re: [perl #77684] Opening references to glob copies
Message ID:

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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About