diff options
author | SADAHIRO Tomoyuki <BQW10602@nifty.com> | 2004-01-18 04:59:55 +0900 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2004-01-17 21:25:08 +0000 |
commit | bac662eeb2cdce47175319fe613f5779e780f517 (patch) | |
tree | 5edd9c93a90f80a8022e07d88d43773b016b6271 /op.c | |
parent | e0767201fcaa7af00aab34d9bca69adf68de6451 (diff) | |
download | perl-bac662eeb2cdce47175319fe613f5779e780f517.tar.gz |
Re: open/or inconsistency
Message-Id: <20040117195729.623A.BQW10602@nifty.com>
(plus a test.)
Don't produce the warning for constructs like
open my $fh, $file or die;
p4raw-id: //depot/perl@22170
Diffstat (limited to 'op.c')
-rw-r--r-- | op.c | 26 |
1 files changed, 17 insertions, 9 deletions
@@ -1865,19 +1865,27 @@ Perl_localize(pTHX_ OP *o, I32 lex) && PL_bufptr > PL_oldbufptr && PL_bufptr[-1] == ',') { char *s = PL_bufptr; - int sigil = 0; + bool sigil = FALSE; /* some heuristics to detect a potential error */ - while (*s && (strchr(", \t\n", *s) - || (strchr("@$%*", *s) && ++sigil) )) + while (*s && (strchr(", \t\n", *s))) s++; - if (sigil) { - while (*s && (isALNUM(*s) || UTF8_IS_CONTINUED(*s) - || strchr("@$%*, \t\n", *s))) - s++; - if (*s == ';' || *s == '=') - Perl_warner(aTHX_ packWARN(WARN_PARENTHESIS), + while (1) { + if (*s && strchr("@$%*", *s) && *++s + && (isALNUM(*s) || UTF8_IS_CONTINUED(*s))) { + s++; + sigil = TRUE; + while (*s && (isALNUM(*s) || UTF8_IS_CONTINUED(*s))) + s++; + while (*s && (strchr(", \t\n", *s))) + s++; + } + else + break; + } + if (sigil && (*s == ';' || *s == '=')) { + Perl_warner(aTHX_ packWARN(WARN_PARENTHESIS), "Parentheses missing around \"%s\" list", lex ? (PL_in_my == KEY_our ? "our" : "my") : "local"); |