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