summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-06-09 21:24:01 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-06-09 21:24:01 -0700
commitfad4a2e4a4e2d22bf0b29de7f20808f0a01e79a2 (patch)
treef6b51a40b445bc5fa5ddd5159e0b5422935eba82 /t
parent6a8709a60c31d74562d0cb240c7a34a5768b3a94 (diff)
downloadperl-fad4a2e4a4e2d22bf0b29de7f20808f0a01e79a2.tar.gz
Scalar keys assignment through lvalue subs
This used not to work: sub foo :lvalue { keys %wallet } foo = 37; Now it does. It was just a matter of following the right code path in op_lvalue when the parent op is a leavesublv instead of a sassign.
Diffstat (limited to 't')
-rw-r--r--t/op/sub_lval.t7
1 files changed, 6 insertions, 1 deletions
diff --git a/t/op/sub_lval.t b/t/op/sub_lval.t
index a9ff88b087..321f5461f2 100644
--- a/t/op/sub_lval.t
+++ b/t/op/sub_lval.t
@@ -3,7 +3,7 @@ BEGIN {
@INC = '../lib';
require './test.pl';
}
-plan tests=>155;
+plan tests=>156;
sub a : lvalue { my $a = 34; ${\(bless \$a)} } # Return a temporary
sub b : lvalue { ${\shift} }
@@ -450,6 +450,11 @@ while (/f/g) {
}
is("@p", "1 8");
+sub keeze : lvalue { keys %__ }
+%__ = ("a","b");
+keeze = 64;
+is scalar %__, '1/64', 'keys assignment through lvalue sub';
+
# Bug 20001223.002: split thought that the list had only one element
@ary = qw(4 5 6);
sub lval1 : lvalue { $ary[0]; }