diff options
-rw-r--r-- | t/lib/warnings/pp_hot | 17 | ||||
-rw-r--r-- | util.c | 5 |
2 files changed, 18 insertions, 4 deletions
diff --git a/t/lib/warnings/pp_hot b/t/lib/warnings/pp_hot index 7df18afb2c..c008dd5f10 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 ; @@ -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) { |