Interpret do CORE() as do-file
authorFather Chrysostomos <sprout@cpan.org>
Tue, 24 Dec 2013 06:48:10 +0000 (22:48 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 24 Dec 2013 16:19:54 +0000 (08:19 -0800)
a96df64385 inadvertently changed it.  do-file is how it has alwas been
interpreted, at least as far back as 5.000, as far as I can tell.

t/op/do.t
toke.c

index aab6bbb..012166e 100644 (file)
--- a/t/op/do.t
+++ b/t/op/do.t
@@ -260,6 +260,16 @@ SKIP: {
     isnt $@, "scrimptious scrobblings", "It was interpreted as do-file";
 }
 
+# do CORE () has always been do-file
+{
+    my $called;
+    sub CORE { $called .= "fungible" }
+    $@ = "scromptious scrimblings";
+    do CORE();
+    is $called, "fungible", "do CORE() calls &CORE";
+    isnt $@, "scromptious scrimblings", "It was interpreted as do-file";
+}
+
 # do subname() and $subname() are no longer allowed
 {
     sub subname { fail('do subname('. ($_[0] || '') .') called') };
diff --git a/toke.c b/toke.c
index b146cdc..ca306f1 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -7891,7 +7891,8 @@ Perl_yylex(pTHX)
                *PL_tokenbuf = '&';
                d = scan_word(s, PL_tokenbuf + 1, sizeof PL_tokenbuf - 1,
                              1, &len);
-               if (len && !keyword(PL_tokenbuf + 1, len, 0)) {
+               if (len && (len != 4 || strNE(PL_tokenbuf+1, "CORE"))
+                && !keyword(PL_tokenbuf + 1, len, 0)) {
                    d = SKIPSPACE1(d);
                    if (*d == '(') {
                        force_ident_maybe_lex('&');