From: Father Chrysostomos Date: Mon, 30 Dec 2013 01:11:24 +0000 (-0800) Subject: Improve rcatline bad fh warnings X-Git-Tag: upstream/5.20.0~898 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d955f84cfebcbed74088977f0bc7b1162c00a426;p=platform%2Fupstream%2Fperl.git Improve rcatline bad fh warnings This is not helpful: append I/O operator() on closed filehandle STDIN at - line 3. append I/O operator() on closed filehandle STDIN at - line 4. (Are you trying to call append I/O operator() on dirhandle STDIN?) That .=<> compiles to a separate op from <> is an implementation detail, so show ‘readline()’ as we do with <>. --- diff --git a/t/lib/warnings/pp_hot b/t/lib/warnings/pp_hot index ad63d2a..4e63073 100644 --- a/t/lib/warnings/pp_hot +++ b/t/lib/warnings/pp_hot @@ -210,6 +210,19 @@ readline() on closed filehandle STDIN at - line 4. (Are you trying to call readline() on dirhandle STDIN?) ######## # pp_hot.c [Perl_do_readline] +use warnings 'closed' ; +close STDIN ; $a .= ; +opendir STDIN, "." ; $a .= ; +closedir STDIN; +no warnings 'closed' ; +opendir STDIN, "." ; $a .= ; +$a = ; +EXPECT +readline() on closed filehandle STDIN at - line 3. +readline() on closed filehandle STDIN at - line 4. + (Are you trying to call readline() on dirhandle STDIN?) +######## +# pp_hot.c [Perl_do_readline] use warnings 'io' ; my $file = "./xcv" ; unlink $file ; open (FH, ">$file") or die $! ; diff --git a/util.c b/util.c index 55fc941..596955b 100644 --- a/util.c +++ b/util.c @@ -3403,7 +3403,8 @@ Perl_report_evil_fh(pTHX_ const GV *gv) (const char *)(OP_IS_FILETEST(op) ? "" : "()"); const char * const func = (const char *) - (op == OP_READLINE ? "readline" : /* "" not nice */ + (op == OP_READLINE || op == OP_RCATLINE + ? "readline" : /* "" not nice */ op == OP_LEAVEWRITE ? "write" : /* "write exit" not nice */ PL_op_desc[op]); const char * const type =