line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PerlIO::via::PinyinConvert; |
2
|
2
|
|
|
2
|
|
21933
|
use Lingua::ZH::PinyinConvert qw/convert/; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
327
|
|
3
|
2
|
|
|
2
|
|
83
|
use 5.006; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
112
|
|
4
|
2
|
|
|
2
|
|
14
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
1006
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $from; |
8
|
|
|
|
|
|
|
our $to; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub import { |
11
|
2
|
|
|
2
|
|
93
|
shift; |
12
|
2
|
|
|
|
|
9
|
my %arg = @_; |
13
|
2
|
|
50
|
|
|
11
|
$from = $arg{from} || die "From what?\n"; |
14
|
2
|
|
50
|
|
|
3712
|
$to = $arg{to} || die "To what?\n"; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub PUSHED { |
18
|
2
|
|
|
2
|
0
|
6170
|
my ($class,$mode,$fh) = @_; |
19
|
2
|
|
|
|
|
7
|
my $buf = ''; |
20
|
2
|
|
|
|
|
259
|
return bless \$buf,$class; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub FILL { |
24
|
0
|
|
|
0
|
0
|
0
|
my ($obj,$fh) = @_; |
25
|
0
|
|
|
|
|
0
|
my $line = <$fh>; |
26
|
0
|
0
|
|
|
|
0
|
return (defined $line) ? convert($from, $to, $line) : undef; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub WRITE { |
30
|
2
|
|
|
2
|
|
37
|
my ($obj,$buf,$fh) = @_; |
31
|
2
|
|
|
|
|
25
|
$$obj .= convert($from, $to, $buf); |
32
|
2
|
|
|
|
|
49
|
return length($buf); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub FLUSH { |
36
|
2
|
|
|
2
|
0
|
25
|
my ($obj,$fh) = @_; |
37
|
2
|
50
|
|
|
|
76
|
print $fh $$obj or return -1; |
38
|
2
|
|
|
|
|
6
|
$$obj = ''; |
39
|
2
|
|
|
|
|
302
|
return 0; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
__END__ |