In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/e6b2cf838e87ec34b3a2043c947b4f723d6efcca?hp=a9b708ba5552bfe8ce5d5a0291df60aca3b2e883>

- Log -----------------------------------------------------------------
commit e6b2cf838e87ec34b3a2043c947b4f723d6efcca
Author: Tony Cook <[email protected]>
Date:   Mon Aug 24 11:46:35 2015 +1000

    [perl #125341] check for unexpected trash after any sub start
-----------------------------------------------------------------------

Summary of changes:
 t/lib/croak/toke | 5 +++++
 toke.c           | 8 +++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/t/lib/croak/toke b/t/lib/croak/toke
index 78ff6cd..64012fb 100644
--- a/t/lib/croak/toke
+++ b/t/lib/croak/toke
@@ -279,3 +279,8 @@ state ($x, $y, state $z);
 EXPECT
 Can't redeclare "state" in "state" at - line 2, near ", "
 Execution of - aborted due to compilation errors.
+########
+# NAME BEGIN <> [perl #125341]
+BEGIN <>
+EXPECT
+Illegal declaration of subroutine BEGIN at - line 1.
diff --git a/toke.c b/toke.c
index d30bfe6..9e332fc 100644
--- a/toke.c
+++ b/toke.c
@@ -8102,7 +8102,13 @@ Perl_yylex(pTHX)
 
                if (*s == ':' && s[1] != ':')
                    PL_expect = attrful;
-               else if ((*s != '{' && *s != '(') && key == KEY_sub) {
+               else if ((*s != '{' && *s != '(') && key != KEY_format) {
+                    assert(key == KEY_sub || key == KEY_AUTOLOAD ||
+                           key == KEY_DESTROY || key == KEY_BEGIN ||
+                           key == KEY_UNITCHECK || key == KEY_CHECK ||
+                           key == KEY_INIT || key == KEY_END ||
+                           key == KEY_my || key == KEY_state ||
+                           key == KEY_our);
                    if (!have_name)
                        Perl_croak(aTHX_ "Illegal declaration of anonymous 
subroutine");
                    else if (*s != ';' && *s != '}')

--
Perl5 Master Repository

Reply via email to