summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-05-30 18:45:26 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-05-30 18:45:26 -0700
commit1ffdc07ca785ef0cec11dad494fa4b9670382300 (patch)
treecfcb218340f886f197de6730fcc50c2374d13854 /t
parentb6d8be65ce3d63a311da4edee2288074a3750f05 (diff)
downloadperl-1ffdc07ca785ef0cec11dad494fa4b9670382300.tar.gz
Make explicit return in lvalue subs work under recursion
This is something that fa1e92c missed.
Diffstat (limited to 't')
-rw-r--r--t/op/sub_lval.t13
1 files changed, 12 insertions, 1 deletions
diff --git a/t/op/sub_lval.t b/t/op/sub_lval.t
index a2b3c2218a..28d67631ac 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=>90;
+plan tests=>91;
sub a : lvalue { my $a = 34; ${\(bless \$a)} } # Return a temporary
sub b : lvalue { ${\shift} }
@@ -571,6 +571,17 @@ is ($Tie_Array::val[0], "value");
++bad_inc(bad_id1(bad_id(bad_get_lex)));
cmp_ok($in, '==', 25);
+
+ # Recursive
+ my $r;
+ my $to_modify;
+ $r = sub :lvalue {
+ my $depth = shift//0;
+ if ($depth == 2) { return $to_modify }
+ return &$r($depth+1);
+ };
+ &$r(0) = 7;
+ is $to_modify, 7, 'recursive lvalue sub';
}
{ # bug #23790