Bareword "FOO" not allowed while "strict subs" in use at - line 4.
Execution of - aborted due to compilation errors.
########
-# TODO: commit 984f9f66477bc722578262ae8520584e44e881af broke this parsing
use strict 'subs';
my @players;
-sub _rankCompare { }
-@players = sort(_rankCompare @players);
+eval { @players = sort(_rankCompare @players) };
+sub _rankCompare2 { }
+@players = sort(_rankCompare2 @players);
EXPECT
########
-# TODO: commit 984f9f66477bc722578262ae8520584e44e881af broke this parsing
use strict;
-readline(STDIN);
+readline(FOO);
EXPECT
+########
+use strict 'subs';
+sub sayfoo { print "foo:@_\n" }
+system sayfoo "bar";
+system sayfoo . "bar";
+EXPECT
+foo:bar
+foo:
/* 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;