This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #117265] move the "glob failed" warning to the point of failure
authorTony Cook <tony@develop-help.com>
Thu, 5 Sep 2013 04:14:00 +0000 (14:14 +1000)
committerTony Cook <tony@develop-help.com>
Mon, 9 Sep 2013 05:22:18 +0000 (15:22 +1000)
This avoids an extraneous warning when globbing fails for other reasons.

doio.c
pp_hot.c

diff --git a/doio.c b/doio.c
index 3988c78..f2c3752 100644 (file)
--- a/doio.c
+++ b/doio.c
@@ -2447,6 +2447,12 @@ Perl_vms_start_glob
     fp = IoIFP(io);
 #endif /* !VMS */
     LEAVE;
+
+    if (!fp && ckWARN(WARN_GLOB)) {
+        Perl_warner(aTHX_ packWARN(WARN_GLOB), "glob failed (can't start child: %s)",
+                    Strerror(errno));
+    }
+
     return fp;
 }
 
index d3f8976..9641b19 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1569,14 +1569,10 @@ Perl_do_readline(pTHX)
     }
     if (!fp) {
        if ((!io || !(IoFLAGS(io) & IOf_START))
-           && ckWARN2(WARN_GLOB, WARN_CLOSED))
+           && ckWARN(WARN_CLOSED)
+            && type != OP_GLOB)
        {
-           if (type == OP_GLOB)
-               Perl_ck_warner_d(aTHX_ packWARN(WARN_GLOB),
-                           "glob failed (can't start child: %s)",
-                           Strerror(errno));
-           else
-               report_evil_fh(PL_last_in_gv);
+           report_evil_fh(PL_last_in_gv);
        }
        if (gimme == G_SCALAR) {
            /* undef TARG, and push that undefined value */