From: Rafael Garcia-Suarez Date: Mon, 27 May 2002 20:25:30 +0000 (+0000) Subject: Fix a warning bug in Perl_report_evil_fh (didn't report X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f62cb720259c484e37beef31bf5247e5e150815a;p=p5sagit%2Fp5-mst-13.2.git Fix a warning bug in Perl_report_evil_fh (didn't report stashes correctly.) Partial info is better than wrong info. p4raw-id: //depot/perl@16821 --- diff --git a/t/lib/warnings/pp_hot b/t/lib/warnings/pp_hot index 7df18af..c008dd5 100644 --- a/t/lib/warnings/pp_hot +++ b/t/lib/warnings/pp_hot @@ -115,6 +115,23 @@ print $fh "Shouldn't print anything, but shouldn't SEGV either\n"; EXPECT print() on closed filehandle at - line 7. ######## +# pp_hot.c [pp_print] +package foo; +use warnings 'closed'; +open my $fh1, "nonexistent"; +print $fh1 42; +open $fh2, "nonexistent"; +print $fh2 42; +open $bar::fh3, "nonexistent"; +print $bar::fh3 42; +open bar::FH4, "nonexistent"; +print bar::FH4 42; +EXPECT +print() on closed filehandle $fh1 at - line 5. +print() on closed filehandle $fh2 at - line 7. +print() on closed filehandle $fh3 at - line 9. +print() on closed filehandle FH4 at - line 11. +######## # pp_hot.c [pp_rv2av] use warnings 'uninitialized' ; my $a = undef ; diff --git a/util.c b/util.c index 3e7b6d3..572b921 100644 --- a/util.c +++ b/util.c @@ -3458,10 +3458,7 @@ Perl_report_evil_fh(pTHX_ GV *gv, IO *io, I32 op) } if (gv && isGV(gv)) { - SV *sv = sv_newmortal(); - gv_efullname4(sv, gv, Nullch, FALSE); - if (SvOK(sv)) - name = SvPVX(sv); + name = GvENAME(gv); } if (op == OP_phoney_OUTPUT_ONLY || op == OP_phoney_INPUT_ONLY) {