Commit | Line | Data |
---|---|---|
0fd86aa7 TC |
1 | #!./perl -w |
2 | # tests that utf8_heavy.pl doesn't use anything that prevents it loading | |
3 | BEGIN { | |
4 | chdir 't' if -d 't'; | |
0fd86aa7 | 5 | require './test.pl'; |
624c42e2 | 6 | set_up_inc('../lib'); |
0fd86aa7 TC |
7 | } |
8 | ||
9 | plan tests => 1; | |
10 | ||
11 | # see [perl #126593] | |
12 | fresh_perl_is(<<'EOP', "", { stderr => 1 }, "doesn't break with \${^ENCODING}"); | |
13 | no warnings qw(deprecated); | |
14 | package Foo; | |
15 | sub cat_decode { | |
16 | # stolen from Encode.pm | |
17 | my ( undef, undef, undef, $pos, $trm ) = @_; | |
18 | my ( $rdst, $rsrc, $rpos ) = \@_[ 1, 2, 3 ]; | |
19 | use bytes; | |
20 | if ( ( my $npos = index( $$rsrc, $trm, $pos ) ) >= 0 ) { | |
21 | $$rdst .= | |
22 | substr( $$rsrc, $pos, $npos - $pos + length($trm) ); | |
23 | $$rpos = $npos + length($trm); | |
24 | return 1; | |
25 | } | |
26 | $$rdst .= substr( $$rsrc, $pos ); | |
27 | $$rpos = length($$rsrc); | |
28 | return q(); | |
29 | } | |
30 | ||
31 | sub decode { | |
32 | my (undef, $tmp) = @_; | |
33 | utf8::decode($tmp); | |
34 | $tmp; | |
35 | } | |
36 | ||
37 | BEGIN { ${^ENCODING} = bless [], q(Foo) }; | |
38 | ||
39 | (my $tmp = q(abc)) =~ tr/abc/123/; | |
40 | EOP |