diff options
author | Tony Cook <tony@develop-help.com> | 2022-06-06 14:52:15 +1000 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2022-07-04 11:41:50 +1000 |
commit | c5327cb77526e4e4c7bb83e24be20ac48e85b1fa (patch) | |
tree | f77aa69c48eb301eba93857f7aa4948fd59bdfcc /toke.c | |
parent | ff49def3c5bf9297dd256667d4cc31f08a628c25 (diff) | |
download | perl-c5327cb77526e4e4c7bb83e24be20ac48e85b1fa.tar.gz |
fix no bareword_filehandles for method calls as first argument of LSTOPs
The original code in toke.c tried to detect a bareword as a
file handle during tokenization rather than once the expression
following the LSTOP has been parsed.
I've moved the checking for a bareword filehandle to the ck functions
for each OP in most cases, which covers most OPs except for LSTOPs
like print.
To handle that I've added a check in newGVREF().
This means in most cases that the error is produced just as the
bareword would normally be wrapped in an OP_RV2GV.
The special case for that is readline(), which does it's own
rv2gv() at runtime, but it does have a ck function which can check
for the bareword handle.
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 6 |
1 files changed, 0 insertions, 6 deletions
@@ -7622,12 +7622,6 @@ yyl_just_a_word(pTHX_ char *s, STRLEN len, I32 orig_keyword, struct code c) } s = SvPVX(PL_linestr) + s_off; - if (((PL_opargs[PL_last_lop_op] >> OASHIFT) & 7) == OA_FILEREF - && !immediate_paren && !c.cv - && !FEATURE_BAREWORD_FILEHANDLES_IS_ENABLED) { - no_bareword_filehandle(PL_tokenbuf); - } - /* If not a declared subroutine, it's an indirect object. */ /* (But it's an indir obj regardless for sort.) */ /* Also, if "_" follows a filetest operator, it's a bareword */ |