From: Rafael Garcia-Suarez Date: Thu, 23 Nov 2006 15:55:47 +0000 (+0000) Subject: Fix for bug #38631: tied variables don't work with .= <> X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0f722b558ffdeebb2a4a1827ea54471c04bdd41d;p=p5sagit%2Fp5-mst-13.2.git Fix for bug #38631: tied variables don't work with .= <> p4raw-id: //depot/perl@29361 --- diff --git a/pp_hot.c b/pp_hot.c index 2ac969a..de2b161 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -1650,6 +1650,8 @@ Perl_do_readline(pTHX) have_fp: if (gimme == G_SCALAR) { sv = TARG; + if (type == OP_RCATLINE && SvGMAGICAL(sv)) + mg_get(sv); if (SvROK(sv)) { if (type == OP_RCATLINE) SvPV_force_nolen(sv); diff --git a/t/op/readline.t b/t/op/readline.t index ffde6f1..394acdb 100644 --- a/t/op/readline.t +++ b/t/op/readline.t @@ -6,7 +6,7 @@ BEGIN { require './test.pl'; } -plan tests => 15; +plan tests => 17; eval { for (\2) { $_ = } }; like($@, 'Modification of a read-only value attempted', '[perl #19566]'); @@ -87,9 +87,21 @@ my $obj = bless []; $obj .= ; like($obj, qr/main=ARRAY.*world/, 'rcatline and refs'); +# bug #38631 +require Tie::Scalar; +tie our $one, 'Tie::StdScalar', "A: "; +tie our $two, 'Tie::StdScalar', "B: "; +my $junk = $one; +$one .= ; +$two .= ; +is( $one, "A: One\n", "rcatline works with tied scalars" ); +is( $two, "B: Two\n", "rcatline works with tied scalars" ); + __DATA__ moo moo rules rules world +One +Two