mirror of
https://github.com/Perl/perl5.git
synced 2026-01-26 16:39:36 +00:00
pp_ctl.c: pp_goto UTF8 cleanup.
This commit is contained in:
parent
c8416c26ff
commit
c271df943c
1
MANIFEST
1
MANIFEST
@ -5238,6 +5238,7 @@ t/uni/chomp.t See if Unicode chomp works
|
||||
t/uni/chr.t See if Unicode chr works
|
||||
t/uni/class.t See if Unicode classes work (\p)
|
||||
t/uni/fold.t See if Unicode folding works
|
||||
t/uni/goto.t See if Unicode goto &sub works
|
||||
t/uni/greek.t See if Unicode in greek works
|
||||
t/uni/gv.t See if Unicode GVs work.
|
||||
t/uni/latin2.t See if Unicode in latin2 works
|
||||
|
||||
5
pp_ctl.c
5
pp_ctl.c
@ -2813,8 +2813,9 @@ PP(pp_goto)
|
||||
/* autoloaded stub? */
|
||||
if (cv != GvCV(gv) && (cv = GvCV(gv)))
|
||||
goto retry;
|
||||
autogv = gv_autoload4(GvSTASH(gv), GvNAME(gv),
|
||||
GvNAMELEN(gv), FALSE);
|
||||
autogv = gv_autoload_pvn(GvSTASH(gv), GvNAME(gv),
|
||||
GvNAMELEN(gv),
|
||||
GvNAMEUTF8(gv) ? SVf_UTF8 : 0);
|
||||
if (autogv && (cv = GvCV(autogv)))
|
||||
goto retry;
|
||||
tmpstr = sv_newmortal();
|
||||
|
||||
41
t/uni/goto.t
Normal file
41
t/uni/goto.t
Normal file
@ -0,0 +1,41 @@
|
||||
#!./perl -w
|
||||
|
||||
BEGIN {
|
||||
require './test.pl';
|
||||
}
|
||||
|
||||
plan tests => 4;
|
||||
|
||||
use utf8;
|
||||
use open qw( :utf8 :std );
|
||||
|
||||
sub goto_baresub {
|
||||
goto &問題の原因;
|
||||
}
|
||||
|
||||
sub goto_softref {
|
||||
goto &{"問題の原因"};
|
||||
}
|
||||
|
||||
sub goto_softref_octal {
|
||||
goto &{"\345\225\217\351\241\214\343\201\256\345\216\237\345\233\240"};
|
||||
}
|
||||
|
||||
sub 問題の原因 {
|
||||
1;
|
||||
}
|
||||
|
||||
ok goto_baresub(), "Magical goto works on an UTF-8 sub,";
|
||||
ok goto_softref(), "..and an UTF-8 softref sub,";
|
||||
|
||||
{
|
||||
local $@;
|
||||
eval { goto_softref_octal() };
|
||||
like $@, qr/Goto undefined subroutine &main::\345\225\217\351\241\214\343\201\256\345\216\237\345\233\240/, "But does NOT find the softref sub when it's lacking the UTF-8 flag";
|
||||
}
|
||||
|
||||
{
|
||||
local $@;
|
||||
eval { goto &因 };
|
||||
like $@, qr/Goto undefined subroutine &main::因/, "goto undefined sub gets the right error message";
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user