a4ac56
From b9a58d500dd75ba783abac92a56e57d41227f62b Mon Sep 17 00:00:00 2001
a4ac56
From: Father Chrysostomos <sprout@cpan.org>
a4ac56
Date: Sun, 2 Jul 2017 11:35:20 -0700
a4ac56
Subject: [PATCH] =?UTF-8?q?[perl=20#131679]=20Fix=20=E2=80=98our=20sub=20f?=
a4ac56
 =?UTF-8?q?oo::bar=E2=80=99=20message?=
a4ac56
MIME-Version: 1.0
a4ac56
Content-Type: text/plain; charset=UTF-8
a4ac56
Content-Transfer-Encoding: 8bit
a4ac56
a4ac56
It should say subroutine, not variable.
a4ac56
a4ac56
Signed-off-by: Petr Písař <ppisar@redhat.com>
a4ac56
---
a4ac56
 t/lib/croak/toke | 6 ++++++
a4ac56
 toke.c           | 3 ++-
a4ac56
 2 files changed, 8 insertions(+), 1 deletion(-)
a4ac56
a4ac56
diff --git a/t/lib/croak/toke b/t/lib/croak/toke
a4ac56
index 7aa15ef..2603224 100644
a4ac56
--- a/t/lib/croak/toke
a4ac56
+++ b/t/lib/croak/toke
a4ac56
@@ -133,6 +133,12 @@ state sub;
a4ac56
 EXPECT
a4ac56
 Missing name in "state sub" at - line 2.
a4ac56
 ########
a4ac56
+# NAME our sub pack::foo
a4ac56
+our sub foo::bar;
a4ac56
+EXPECT
a4ac56
+No package name allowed for subroutine &foo::bar in "our" at - line 1, near "our sub foo::bar"
a4ac56
+Execution of - aborted due to compilation errors.
a4ac56
+########
a4ac56
 # NAME my sub pack::foo
a4ac56
 use feature 'lexical_subs', 'state';
a4ac56
 my sub foo::bar;
a4ac56
diff --git a/toke.c b/toke.c
a4ac56
index ace92e3..6aa5f26 100644
a4ac56
--- a/toke.c
a4ac56
+++ b/toke.c
a4ac56
@@ -8848,7 +8848,8 @@ S_pending_ident(pTHX)
a4ac56
         if (PL_in_my == KEY_our) {	/* "our" is merely analogous to "my" */
a4ac56
             if (has_colon)
a4ac56
                 yyerror_pv(Perl_form(aTHX_ "No package name allowed for "
a4ac56
-                                  "variable %s in \"our\"",
a4ac56
+                                  "%se %s in \"our\"",
a4ac56
+                                  *PL_tokenbuf=='&' ?"subroutin":"variabl",
a4ac56
                                   PL_tokenbuf), UTF ? SVf_UTF8 : 0);
a4ac56
             tmp = allocmy(PL_tokenbuf, tokenbuf_len, UTF ? SVf_UTF8 : 0);
a4ac56
         }
a4ac56
-- 
a4ac56
2.9.4
a4ac56