summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Fraser <fraserbn@gmail.com>2011-08-20 08:50:42 +0100
committerFather Chrysostomos <sprout@cpan.org>2012-03-25 13:43:58 -0700
commit979a1401b9405575b13e8d51d239f9bf0b74d0aa (patch)
treef2f5066129959268ec1d14566ed4b76210c7b494
parent86fe3f368e07f69cb20296f510fcb1d5ce6b3777 (diff)
downloadperl-979a1401b9405575b13e8d51d239f9bf0b74d0aa.tar.gz
toke.c: "Bareword "%s" refers to nonexistent package" cleanup.
-rw-r--r--t/lib/warnings/toke24
-rw-r--r--toke.c5
2 files changed, 27 insertions, 2 deletions
diff --git a/t/lib/warnings/toke b/t/lib/warnings/toke
index a6841d2d09..f4ac3849ea 100644
--- a/t/lib/warnings/toke
+++ b/t/lib/warnings/toke
@@ -616,6 +616,30 @@ EXPECT
Bareword "FRED::" refers to nonexistent package at bar line 25.
########
# toke.c
+use utf8;
+use open qw( :utf8 :std );
+use warnings 'bareword' ;
+#line 25 "bar"
+$a = FRÈD:: ;
+no warnings 'bareword' ;
+#line 25 "bar"
+$a = FRÈD:: ;
+EXPECT
+Bareword "FRÈD::" refers to nonexistent package at bar line 25.
+########
+# toke.c
+use utf8;
+use open qw( :utf8 :std );
+use warnings 'bareword' ;
+#line 25 "bar"
+$a = ϞϞϞ:: ;
+no warnings 'bareword' ;
+#line 25 "bar"
+$a = ϞϞϞ:: ;
+EXPECT
+Bareword "ϞϞϞ::" refers to nonexistent package at bar line 25.
+########
+# toke.c
use warnings 'ambiguous' ;
sub time {}
my $a = time() ;
diff --git a/toke.c b/toke.c
index 4dbf00d6d4..a8509fce10 100644
--- a/toke.c
+++ b/toke.c
@@ -6687,8 +6687,9 @@ Perl_yylex(pTHX)
if (ckWARN(WARN_BAREWORD)
&& ! gv_fetchpvn_flags(PL_tokenbuf, len, UTF ? SVf_UTF8 : 0, SVt_PVHV))
Perl_warner(aTHX_ packWARN(WARN_BAREWORD),
- "Bareword \"%s\" refers to nonexistent package",
- PL_tokenbuf);
+ "Bareword \"%"SVf"\" refers to nonexistent package",
+ SVfARG(newSVpvn_flags(PL_tokenbuf, len,
+ (UTF ? SVf_UTF8 : 0) | SVs_TEMP)));
len -= 2;
PL_tokenbuf[len] = '\0';
gv = NULL;