From: Hugo van der Sanden Date: Sat, 13 Jul 2002 17:44:02 +0000 (+0100) Subject: Re: [ID 20020713.001] chomp($data=) strangeness. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0b7c7b4fb6ccb6a1032c282f90fca89d5d3dbb58;p=p5sagit%2Fp5-mst-13.2.git Re: [ID 20020713.001] chomp($data=) strangeness. Message-id: <200207131644.g6DGi2214456@crypt.compulink.co.uk> p4raw-id: //depot/perl@17716 --- diff --git a/pp_hot.c b/pp_hot.c index 8f042b9..8e36c8a 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -1490,8 +1490,11 @@ Perl_do_readline(pTHX) call_method("READLINE", gimme); LEAVE; SPAGAIN; - if (gimme == G_SCALAR) - SvSetMagicSV_nosteal(TARG, TOPs); + if (gimme == G_SCALAR) { + SV* result = POPs; + SvSetSV_nosteal(TARG, result); + PUSHTARG; + } RETURN; } fp = Nullfp; diff --git a/t/op/tiehandle.t b/t/op/tiehandle.t index 257a613..818cecf 100755 --- a/t/op/tiehandle.t +++ b/t/op/tiehandle.t @@ -77,7 +77,7 @@ package main; use Symbol; -print "1..39\n"; +print "1..40\n"; my $fh = gensym; @@ -230,3 +230,15 @@ ok($r == 1); Implement::compare(PRINT => @received); } +{ + # [ID 20020713.001] chomp($data=) + local *TEST; + tie *TEST, 'CHOMP'; + my $data; + chomp($data = ); + ok($data eq 'foobar'); + + package CHOMP; + sub TIEHANDLE { bless {}, $_[0] } + sub READLINE { "foobar\n" } +}