line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package uni::perl::encodebase; |
2
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
39
|
use uni::perl; |
|
8
|
|
|
|
|
32
|
|
|
7
|
|
|
|
|
85
|
|
4
|
|
|
|
|
|
|
m{ |
5
|
|
|
|
|
|
|
use strict; |
6
|
|
|
|
|
|
|
use warnings; |
7
|
|
|
|
|
|
|
}x; |
8
|
7
|
|
|
8
|
|
9988
|
use Encode (); |
|
7
|
|
|
|
|
105419
|
|
|
7
|
|
|
|
|
951
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub _generate($;$) { |
11
|
10
|
|
|
10
|
|
24
|
my ($pkg, $encoding) = @_; |
12
|
10
|
|
33
|
|
|
35
|
$encoding //= $pkg; |
13
|
10
|
50
|
|
|
|
77
|
my $e = Encode::find_encoding($encoding) |
14
|
|
|
|
|
|
|
or croak "Can't load encoding `$encoding'"; |
15
|
10
|
|
|
|
|
5195
|
my $as = 'uni::perl'; |
16
|
10
|
|
|
|
|
71
|
my $decode = $e->can('decode'); |
17
|
10
|
|
|
|
|
33
|
my $encode = $e->can('encode'); |
18
|
|
|
|
|
|
|
{ |
19
|
7
|
|
|
7
|
|
63
|
no strict 'refs'; |
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
2257
|
|
|
10
|
|
|
|
|
19
|
|
20
|
10
|
|
|
|
|
25
|
for my $method (qw(encode decode)) { |
21
|
20
|
50
|
|
|
|
341
|
if (defined &{$pkg.'::'.$method}) { |
|
20
|
|
|
|
|
110
|
|
22
|
0
|
|
|
|
|
0
|
carp "$pkg\::$method already defined" |
23
|
0
|
0
|
|
|
|
0
|
if ref \&{$pkg.'::'.$method} ne $as; |
24
|
|
|
|
|
|
|
} else { |
25
|
20
|
|
|
|
|
70
|
my $s = qq{ |
26
|
|
|
|
|
|
|
sub $pkg\::$method (\$;\$) { \$e->\$$method(\@_); }; |
27
|
|
|
|
|
|
|
#bless \\&$pkg\::$method, '$as'; |
28
|
|
|
|
|
|
|
1 |
29
|
|
|
|
|
|
|
}; |
30
|
20
|
50
|
|
2
|
|
2363
|
eval $s or die "$s\n$@"; |
|
2
|
|
|
0
|
|
15
|
|
|
0
|
|
|
2
|
|
0
|
|
|
2
|
|
|
1
|
|
3357
|
|
|
1
|
|
|
|
|
4896
|
|
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
10
|
|
|
|
|
52
|
return; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub generate { |
38
|
8
|
100
|
|
8
|
0
|
108
|
_generate(ref $_ ? $_->[0] : $_, ref $_ ? $_->[1] : $_) for (@_); |
|
|
100
|
|
|
|
|
|
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |