line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PerlIO::via::json; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
39672
|
use 5.008001; |
|
3
|
|
|
|
|
7
|
|
4
|
3
|
|
|
3
|
|
9
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
49
|
|
5
|
3
|
|
|
3
|
|
12
|
use warnings; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
101
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
1352
|
use XML::XML2JSON; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
### PerlIO::via interface |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub PUSHED { |
15
|
|
|
|
|
|
|
bless { |
16
|
|
|
|
|
|
|
obj => XML::XML2JSON->new() |
17
|
|
|
|
|
|
|
}, $_[0]; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub FILL { |
21
|
|
|
|
|
|
|
my ($self, $fh) = @_; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
local $/; |
24
|
|
|
|
|
|
|
my $t = <$fh>; |
25
|
|
|
|
|
|
|
(defined $t) ? $self->{obj}->xml2json($t) : undef; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub WRITE { |
29
|
|
|
|
|
|
|
my ($self, $buf, $fh) = @_; |
30
|
|
|
|
|
|
|
if (print $fh $self->{obj}->json2xml($buf)) { |
31
|
|
|
|
|
|
|
return length($buf); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
else { |
34
|
|
|
|
|
|
|
return -1; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
__END__ |