From: Rafael Garcia-Suarez Date: Tue, 14 Nov 2006 14:19:46 +0000 (+0000) Subject: Fix bug #39037: rcatline doesn't stringify references X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=48de12d940c558762a4819fcf31deba3b8cb6fea;p=p5sagit%2Fp5-mst-13.2.git Fix bug #39037: rcatline doesn't stringify references p4raw-id: //depot/perl@29273 --- diff --git a/pp_hot.c b/pp_hot.c index 025e957..9b293de 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -1640,8 +1640,12 @@ Perl_do_readline(pTHX) have_fp: if (gimme == G_SCALAR) { sv = TARG; - if (SvROK(sv)) - sv_unref(sv); + if (SvROK(sv)) { + if (type == OP_RCATLINE) + SvPV_force_nolen(sv); + else + sv_unref(sv); + } else if (isGV_with_GP(sv)) { SvPV_force_nolen(sv); } diff --git a/t/op/readline.t b/t/op/readline.t index 6dfe695..ffde6f1 100644 --- a/t/op/readline.t +++ b/t/op/readline.t @@ -6,7 +6,7 @@ BEGIN { require './test.pl'; } -plan tests => 14; +plan tests => 15; eval { for (\2) { $_ = } }; like($@, 'Modification of a read-only value attempted', '[perl #19566]'); @@ -83,8 +83,13 @@ fresh_perl_is('BEGIN{<>}', '', { switches => ['-w'], stdin => '', stderr => 1 }, 'No ARGVOUT used only once warning'); +my $obj = bless []; +$obj .= ; +like($obj, qr/main=ARRAY.*world/, 'rcatline and refs'); + __DATA__ moo moo rules rules +world