From: Gurusamy Sarathy Date: Tue, 23 Mar 1999 00:56:38 +0000 (+0000) Subject: avoid typeglob persistence in pp_readline() X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=994914430a9d31e91f3ba7f46998670879b75792;p=p5sagit%2Fp5-mst-13.2.git avoid typeglob persistence in pp_readline() p4raw-id: //depot/perl@3125 --- diff --git a/sv.c b/sv.c index 4014204..350b053 100644 --- a/sv.c +++ b/sv.c @@ -3176,7 +3176,13 @@ sv_gets(register SV *sv, register PerlIO *fp, I32 append) I32 i; SV_CHECK_THINKFIRST(sv); - (void)SvUPGRADE(sv, SVt_PV); + if (SvTYPE(sv) >= SVt_PV) { + if (SvFAKE(sv) && SvTYPE(sv) == SVt_PVGV) + sv_unglob(sv); + } + else + sv_upgrade(sv, SVt_PV); + SvSCREAM_off(sv); if (RsSNARF(PL_rs)) { diff --git a/t/op/gv.t b/t/op/gv.t index df4984e..10d84ee 100755 --- a/t/op/gv.t +++ b/t/op/gv.t @@ -4,7 +4,7 @@ # various typeglob tests # -print "1..29\n"; +print "1..30\n"; # type coersion on assignment $foo = 'foo'; @@ -121,3 +121,13 @@ print {*x{FILEHANDLE}} "ok 23\n"; ++$test; &{$a}; } +# does pp_readline() handle glob-ness correctly? + +{ + my $g = *foo; + $g = ; + print $g; +} + +__END__ +ok 30