diff options
-rw-r--r-- | pp_hot.c | 7 | ||||
-rwxr-xr-x | t/op/tiehandle.t | 14 |
2 files changed, 18 insertions, 3 deletions
@@ -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 257a613958..818cecf185 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=<tied_fh>) + local *TEST; + tie *TEST, 'CHOMP'; + my $data; + chomp($data = <TEST>); + ok($data eq 'foobar'); + + package CHOMP; + sub TIEHANDLE { bless {}, $_[0] } + sub READLINE { "foobar\n" } +} |