This queue is for tickets about the Data-Alias CPAN distribution.

Report information
The Basics
Id:
127717
Status:
new
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
felix.ostmann [...] gmail.com
Cc:
AdminCc:

BugTracker
Severity:
Important
Broken in:
1.21
Fixed in:
(no value)



Subject: alias local leaves hashkey set after scope
MIME-Version: 1.0
X-Mailer: MIME-tools 5.504 (Entity 5.504)
X-RT-Interface: Web
Message-ID: <rt-4.0.18-16646-1542537711-1772.0-0-0@rt.cpan.org>
X-RT-Original-Encoding: utf-8
Content-Type: multipart/mixed; boundary="----------=_1542537712-16646-3"
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 0
Content-Disposition: inline
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: binary
Content-Length: 587
Hello, combining alias + local did not work as expected. Without Data::Alias: $ perl -MData::Dumper -MData::Alias -e ' my $foo = 1; my $bar = {}; { local $bar->{foo} = $foo; print Dumper($bar); } print Dumper($bar);' $VAR1 = { 'foo' => 1 }; $VAR1 = {}; With Data::Alias: $ perl -MData::Dumper -MData::Alias -e ' my $foo = 1; my $bar = {}; { alias local $bar->{foo} = $foo; print Dumper($bar); } print Dumper($bar);' $VAR1 = { 'foo' => 1 }; $VAR1 = { 'foo' => undef }; Attached is a failing test for this scenario.
Subject: alias-local-failing-test.patch
MIME-Version: 1.0
Content-Type: text/x-patch; name="alias-local-failing-test.patch"
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline; filename="alias-local-failing-test.patch"
Content-Transfer-Encoding: binary
Content-Length: 542
--- 20_alias_helem.t.orig 2018-11-18 11:36:37.057307733 +0100 +++ 20_alias_helem.t 2018-11-18 11:38:56.935701230 +0100 @@ -3,7 +3,7 @@ use strict; use warnings qw(FATAL all); use lib 'lib'; -use Test::More tests => 38; +use Test::More tests => 42; use Data::Alias; @@ -28,6 +28,11 @@ alias { is \(local $x{0} = $x{1}), \$x{1}; is \$x{0}, \$x{1} }; is \$x{0}, \$x{2}; +ok !exists $x{3}; + +alias { is \(local $x{3} = $x{1}), \$x{1}; is \$x{3}, \$x{1} }; +ok !exists $x{3}; + is \alias($x{0} = undef), \undef; ok !exists $x{0};


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.