In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/645d8892bdf2a7e5afe985dfd321b2d332930f62?hp=e47aeb2216a047eb0bd36de07ff716103c3d29c5>
- Log ----------------------------------------------------------------- commit 645d8892bdf2a7e5afe985dfd321b2d332930f62 Author: George Greer <p...@greerga.m-l.org> Date: Sun Jul 18 20:01:32 2010 -0400 Test for RT#3363: lexical lvalue under recursion Add a test to ensure that S_refto returns a SVt_PVLV if the original is a SVt_PVLV so that the lvalue-ness is preserved. ----------------------------------------------------------------------- Summary of changes: t/op/sub_lval.t | 19 ++++++++++++++++++- 1 files changed, 18 insertions(+), 1 deletions(-) diff --git a/t/op/sub_lval.t b/t/op/sub_lval.t index f754782..aedaba0 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=>73; +plan tests=>74; sub a : lvalue { my $a = 34; ${\(bless \$a)} } # Return a temporary sub b : lvalue { ${\shift} } @@ -575,3 +575,20 @@ sub fleen : lvalue { $pnare } $pnare = __PACKAGE__; ok eval { fleen = 1 }, "lvalues can return COWs (CATTLE?) [perl #75656]";\ is $pnare, 1, 'and returning CATTLE actually works'; + +{ + my $result_3363; + sub a_3363 { + my ($word, $replace) = @_; + my $ref = \substr($word, 0, 1); + $$ref = $replace; + if ($replace eq "b") { + $result_3363 = $word; + } else { + a_3363($word, "b"); + } + } + a_3363($_, "v") for "test"; + + is($result_3363, "best", "ref-to-substr retains lvalue-ness under recursion [perl #3363]"); +} -- Perl5 Master Repository