From 240d1b6fec0bdaf633ffc53476ade6401c251270 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Thu, 8 Dec 2011 13:09:39 -0800 Subject: [PATCH] =?utf8?q?Don=E2=80=99t=20warn=20for=20open=20local=20*FH?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit There is this ancient ‘Precedence problem’ warning that warns for open followed by a bareword and then an operator that would have made open into a unary-precedence operator in Perl 4. It was not taking into account that the bareword might be a Perl keyword. In that case it shouldn’t be warning. --- t/lib/warnings/toke | 1 + toke.c | 1 + 2 files changed, 2 insertions(+) diff --git a/t/lib/warnings/toke b/t/lib/warnings/toke index 95612eb..25d53a0 100644 --- a/t/lib/warnings/toke +++ b/t/lib/warnings/toke @@ -644,6 +644,7 @@ Ambiguous use of -fred resolved as -&fred() at - line 11. ######## # toke.c open FOO || time; +open local *FOO; # should be ok EXPECT Precedence problem: open FOO should be open(FOO) at - line 2. ######## diff --git a/toke.c b/toke.c index e5da941..2c29c58 100644 --- a/toke.c +++ b/toke.c @@ -7672,6 +7672,7 @@ Perl_yylex(pTHX) if ( *t && strchr("|&*+-=!?:.", *t) && ckWARN_d(WARN_PRECEDENCE) /* [perl #16184] */ && !(t[0] == '=' && t[1] == '>') + && !keyword(s, d-s, 0) ) { int parms_len = (int)(d-s); Perl_warner(aTHX_ packWARN(WARN_PRECEDENCE), -- 2.7.4