This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
toke.c: 'You need to quote %s' cleanup.
authorBrian Fraser <fraserbn@gmail.com>
Sat, 6 Aug 2011 07:05:16 +0000 (08:05 +0100)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 23 Mar 2012 03:23:53 +0000 (20:23 -0700)
t/lib/warnings/toke
toke.c

index 4c6c8fe..2214005 100644 (file)
@@ -237,6 +237,26 @@ EXPECT
 You need to quote "fred" at - line 3.
 ########
 # toke.c
+use utf8;
+use open qw( :utf8 :std );
+use warnings 'syntax' ;
+sub frèd {} ; $SIG{TERM} = frèd;
+no warnings 'syntax' ;
+$SIG{TERM} = frèd;
+EXPECT
+You need to quote "frèd" at - line 5.
+########
+# toke.c
+use utf8;
+use open qw( :utf8 :std );
+use warnings 'syntax' ;
+sub ふれど {} ; $SIG{TERM} = ふれど;
+no warnings 'syntax' ;
+$SIG{TERM} = ふれど;
+EXPECT
+You need to quote "ふれど" at - line 5.
+########
+# toke.c
 use warnings 'syntax' ;
 @a[3] = 2;
 @a{3} = 2;
diff --git a/toke.c b/toke.c
index c0a5cda..426eb2c 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -6184,10 +6184,12 @@ Perl_yylex(pTHX)
                                              &len);
                                while (isSPACE(*t))
                                    t++;
-                               if (*t == ';' && get_cvn_flags(tmpbuf, len, 0))
+                               if (*t == ';'
+                                       && get_cvn_flags(tmpbuf, len, UTF ? SVf_UTF8 : 0))
                                    Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
-                                               "You need to quote \"%s\"",
-                                               tmpbuf);
+                                               "You need to quote \"%"SVf"\"",
+                                                 SVfARG(newSVpvn_flags(tmpbuf, len, 
+                                                    SVs_TEMP | (UTF ? SVf_UTF8 : 0))));
                            }
                        }
                }