develooper Front page | perl.perl5.porters | Postings from October 2013

[perl #119797] lvalue sub shows "Bizarre copy of ARRAY in block exit" in very specific case.

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
October 24, 2013 19:44
Subject:
[perl #119797] lvalue sub shows "Bizarre copy of ARRAY in block exit" in very specific case.
Message ID:
rt-4.0.18-14651-1382643891-839.119797-15-0@perl.org
On Wed Oct 23 21:34:26 2013, sprout wrote:
> On Wed Oct 23 06:08:23 2013, sprout wrote:
> > On Sun Sep 15 11:26:14 2013, sprout wrote:
> > > On Sun Sep 15 09:10:35 2013, jkeenan wrote:
> > > > On Sun Sep 15 07:10:48 2013, sprout wrote:
> > > > > #!perl
> > > > > my @this = ();
> > > > > 
> > > > > (that()) = ();
> > > > > print "@this\n";
> > > > > 
> > > > > sub that :lvalue { if (@this) { } else { @this; } }
> > > > > __END__
> > > > > 
> > > > > That gives me a bizarre copy.
> > 
> > The bug is worse than that.  The cases that do not get a bizarre copy do
> > not return assignable arrays, either:
> > 
> > use Test::More 'no_plan';
> > sub if119797 : lvalue {
> >     if ($_[0]) {
> > 	@119797
> >     }
> > }
> > eval { (if119797(1)) = 4..6 };
> > is $@, "", '$@ after writing to array returned by if';
> > is "@119797", "4 5 6", 'writing to array returned by if';
> 
> I have fixed both those issues in commit 2ec7f6f242.
> 
> But it turns out that bare blocks exhibit similar problems.  I will
> probably fix that tomorrow.

Now done with commit a373464fd.

-- 

Father Chrysostomos


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

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