A word following do is forced to be a bareword for do-sub’s sake. But
if it is going to be interpreted as do-file after all, that does not
make sense. ‘do subname;’ should call the sub and run the file whose
name it returns, instead of running the file named ‘subname’.
ok($saved_errno, "\$! set on io error");
}
+# do subname should not be do "subname"
+{
+ my $called;
+ sub fungi { $called .= "fungible" }
+ $@ = "scrimptious scrobblings";
+ do fungi;
+ is $called, "fungible", "do-file does not force bareword";
+ isnt $@, "scrimptious scrobblings", "It was interpreted as do-file";
+}
+
done_testing();
s = SKIPSPACE1(s);
if (*s == '{')
PRETERMBLOCK(DO);
- if (*s != '\'')
- s = force_word(s,WORD,TRUE,TRUE,FALSE);
+ if (*s != '\'') {
+ d = scan_word(s, PL_tokenbuf, sizeof PL_tokenbuf, 1, &len);
+ if (len) {
+ d = SKIPSPACE1(d);
+ if (*d == '(') s = force_word(s,WORD,TRUE,TRUE,FALSE);
+ }
+ }
if (orig_keyword == KEY_do) {
orig_keyword = 0;
pl_yylval.ival = 1;