1898184e3Ssthen#!./perl -w 2898184e3Ssthen 3898184e3SsthenBEGIN { 4*b8851fccSafresh1 chdir 't' if -d 't'; 5898184e3Ssthen require './test.pl'; 6898184e3Ssthen} 7898184e3Ssthen 8898184e3Ssthenplan tests => 4; 9898184e3Ssthen 10898184e3Ssthenuse utf8; 11898184e3Ssthenuse open qw( :utf8 :std ); 12898184e3Ssthen 13898184e3Ssthensub goto_baresub { 14898184e3Ssthen goto &問題の原因; 15898184e3Ssthen} 16898184e3Ssthen 17898184e3Ssthensub goto_softref { 18898184e3Ssthen goto &{"問題の原因"}; 19898184e3Ssthen} 20898184e3Ssthen 21898184e3Ssthensub goto_softref_octal { 22898184e3Ssthen goto &{"\345\225\217\351\241\214\343\201\256\345\216\237\345\233\240"}; 23898184e3Ssthen} 24898184e3Ssthen 25898184e3Ssthensub 問題の原因 { 26898184e3Ssthen 1; 27898184e3Ssthen} 28898184e3Ssthen 29898184e3Ssthenok goto_baresub(), "Magical goto works on an UTF-8 sub,"; 30898184e3Ssthenok goto_softref(), "..and an UTF-8 softref sub,"; 31898184e3Ssthen 32898184e3Ssthen{ 33898184e3Ssthen local $@; 34898184e3Ssthen eval { goto_softref_octal() }; 35898184e3Ssthen 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"; 36898184e3Ssthen} 37898184e3Ssthen 38898184e3Ssthen{ 39898184e3Ssthen local $@; 40898184e3Ssthen eval { goto &因 }; 41898184e3Ssthen like $@, qr/Goto undefined subroutine &main::因/, "goto undefined sub gets the right error message"; 42898184e3Ssthen} 43