develooper Front page | perl.perl5.porters | Postings from November 2018

[perl #133538] refaliasing does not work

Thread Previous
From:
James E Keenan via RT
Date:
November 5, 2018 13:10
Subject:
[perl #133538] refaliasing does not work
Message ID:
rt-4.0.24-20770-1541423435-1498.133538-15-0@perl.org
On Mon, 05 Nov 2018 12:39:29 GMT, davem wrote:
> On Sat, Sep 22, 2018 at 02:56:46AM -0700, KES (via RT) wrote:
> > my @list = ( 1, 2, 3 );
> >
> > # Test 1
> > my %hash =  ();
> > {
> >         \( @hash{qw/ a b c /} ) =  \(@list);
> > }
> > print %hash;  # abc
> >
> >
> > values are destroed from hash when we leave the block
> 
> 
> Now fixed in blead with the following commit:
> 
> commit b97fe865adca6799771c93fc17e9f36ae7272e72
> Author:     David Mitchell <davem@iabyn.com>
> AuthorDate: Mon Nov 5 12:29:27 2018 +0000
> Commit:     David Mitchell <davem@iabyn.com>
> CommitDate: Mon Nov 5 12:29:27 2018 +0000
> 
> Don't localise array / hash slice ref assignment
> 
> RT #133538
> 
> The experimental ref assignment aliasing feature, when applied to
> array or hash slices, was treating the slice as if it was always
> localized;
> e.g.
> 
> \(@a[3,5,7]) = \(....);
> 
> was being interpreted as
> 
> local \(@a[3,5,7]) = \(....);
> 
> The fix is simple: check for the OPpLVAL_INTRO flag actually being set
> on the op, rather than unconditionally localising the array/hash
> elements.

Works on my test files.  Thanks.

-- 
James E Keenan (jkeenan@cpan.org)

---
via perlbug:  queue: perl5 status: pending release
https://rt.perl.org/Ticket/Display.html?id=133538

Thread Previous


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