Re: [perl #16184] Unexpected warning when using C<< open FH => >>
Hugo van der Sanden [Mon, 21 Oct 2002 11:27:40 +0000 (12:27 +0100)]
Message-Id: <200210211027.g9LARef05722@crypt.compulink.co.uk>

p4raw-id: //depot/perl@18042

t/lib/warnings/toke
toke.c

index 0a5346a..ca0dc6e 100644 (file)
@@ -614,6 +614,10 @@ open FOO || time;
 EXPECT
 Precedence problem: open FOO should be open(FOO) at - line 2.
 ########
+# toke.c (and [perl #16184])
+open FOO => "<&0"; close FOO;
+EXPECT
+########
 # toke.c
 $^W = 0 ;
 open FOO || time;
diff --git a/toke.c b/toke.c
index d3bdf39..b4c886f 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -4648,10 +4648,14 @@ Perl_yylex(pTHX)
                char *t;
                for (d = s; isALNUM_lazy_if(d,UTF); d++) ;
                t = skipspace(d);
-               if (strchr("|&*+-=!?:.", *t) && ckWARN_d(WARN_PRECEDENCE))
+               if (strchr("|&*+-=!?:.", *t) && ckWARN_d(WARN_PRECEDENCE)
+                   /* [perl #16184] */
+                   && !(t[0] == '=' && t[1] == '>')
+               ) {
                    Perl_warner(aTHX_ packWARN(WARN_PRECEDENCE),
                           "Precedence problem: open %.*s should be open(%.*s)",
-                           d-s,s, d-s,s);
+                           d - s, s, d - s, s);
+               }
            }
            LOP(OP_OPEN,XTERM);