The lexer’s bareword-parser that kicks in after it sees ‘require’ was
getting confused by the single colon, since it assumed that if the
thing that followed began with a letter or colon it must be a package
or module name. Hence, require with : after it was parsed as
require "", but with a ‘bareword’ "". The lexer should be checking
for two colons, not just one.
BEGIN { chdir 't' if -d 't'; require './test.pl'; }
-plan(tests => 25);
+plan(tests => 26);
{
no warnings 'deprecated';
{ stderr => 1 },
's;@{<<a; [perl #123995]'
);
+
+fresh_perl_is(
+ '$_ = q-strict.pm-; 1 ? require : die;'
+ .' print qq-ok\n- if $INC{q-strict.pm-}',
+ "ok\n",
+ 'foo ? require : bar [perl #128307]'
+);
start = skipspace(start);
s = start;
if (isIDFIRST_lazy_if(s,UTF)
- || (allow_pack && *s == ':') )
+ || (allow_pack && *s == ':' && s[1] == ':') )
{
s = scan_word(s, PL_tokenbuf, sizeof PL_tokenbuf, allow_pack, &len);
if (check_keyword) {