summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-08-23 15:28:22 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-08-23 15:28:22 +0200
commit9a073a1d1a270eb53990cb82ec7af8ae00d667c4 (patch)
treeca2262f8207bea7484f4d273ec48ec08423b09ba /toke.c
parent52a66c2cc3722485e8a16f1da9c026524180ca8c (diff)
downloadperl-9a073a1d1a270eb53990cb82ec7af8ae00d667c4.tar.gz
Fix parsing of readline(FH) [perl #68458]
This was broken by commit 984f9f66477bc722578262ae8520584e44e881af, which was committed to solve bug [perl #53806]. Basically, to make everyone happy, we need only to enforce strictures on barewords that follow the specially parsed keywords "print" and "exec" (and similar) -- except when they have been already parsed.
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/toke.c b/toke.c
index b264279a74..734c516b82 100644
--- a/toke.c
+++ b/toke.c
@@ -5699,10 +5699,22 @@ Perl_yylex(pTHX)
/* Call it a bare word */
- bareword:
if (PL_hints & HINT_STRICT_SUBS)
pl_yylval.opval->op_private |= OPpCONST_STRICT;
else {
+ bareword:
+ /* after "print" and similar functions (corresponding to
+ * "F? L" in opcode.pl), whatever wasn't already parsed as
+ * a filehandle should be subject to "strict subs".
+ * Likewise for the optional indirect-object argument to system
+ * or exec, which can't be a bareword */
+ if ((PL_last_lop_op == OP_PRINT
+ || PL_last_lop_op == OP_PRTF
+ || PL_last_lop_op == OP_SAY
+ || PL_last_lop_op == OP_SYSTEM
+ || PL_last_lop_op == OP_EXEC)
+ && (PL_hints & HINT_STRICT_SUBS))
+ pl_yylval.opval->op_private |= OPpCONST_STRICT;
if (lastchar != '-') {
if (ckWARN(WARN_RESERVED)) {
d = PL_tokenbuf;