line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package XML::Fast; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
162378
|
use 5.008008; |
|
6
|
|
|
|
|
29
|
|
4
|
6
|
|
|
6
|
|
43
|
use strict; |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
180
|
|
5
|
6
|
|
|
6
|
|
39
|
use warnings;no warnings 'uninitialized'; |
|
6
|
|
|
6
|
|
18
|
|
|
6
|
|
|
|
|
225
|
|
|
6
|
|
|
|
|
38
|
|
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
241
|
|
6
|
6
|
|
|
6
|
|
3719
|
use Encode; |
|
6
|
|
|
|
|
68889
|
|
|
6
|
|
|
|
|
628
|
|
7
|
|
|
|
|
|
|
|
8
|
6
|
|
|
6
|
|
64
|
use base 'Exporter'; |
|
6
|
|
|
|
|
18
|
|
|
6
|
|
|
|
|
1616
|
|
9
|
|
|
|
|
|
|
our @EXPORT_OK = our @EXPORT = qw( xml2hash hash2xml ); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.17'; |
12
|
|
|
|
|
|
|
|
13
|
6
|
|
|
6
|
|
931
|
use XSLoader; |
|
6
|
|
|
|
|
20
|
|
|
6
|
|
|
|
|
1134
|
|
14
|
|
|
|
|
|
|
XSLoader::load('XML::Fast', $VERSION); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub xml2hash($;%) { |
17
|
52
|
|
|
52
|
1
|
37634
|
my $xml = shift; |
18
|
52
|
|
|
|
|
308
|
my %args = ( |
19
|
|
|
|
|
|
|
order => 0, # not impl |
20
|
|
|
|
|
|
|
attr => '-', # ok |
21
|
|
|
|
|
|
|
text => '#text', # ok |
22
|
|
|
|
|
|
|
join => '', # ok |
23
|
|
|
|
|
|
|
trim => 1, # ok |
24
|
|
|
|
|
|
|
cdata => undef, # ok + fallback -> text |
25
|
|
|
|
|
|
|
comm => undef, # ok |
26
|
|
|
|
|
|
|
@_ |
27
|
|
|
|
|
|
|
); |
28
|
52
|
|
|
|
|
7131
|
_xml2hash($xml,\%args); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub hash2xml($;%) { |
32
|
0
|
|
|
0
|
1
|
|
my $xml = shift; |
33
|
0
|
|
|
|
|
|
my %args = ( |
34
|
|
|
|
|
|
|
order => 0, # not impl |
35
|
|
|
|
|
|
|
attr => '-', # ok |
36
|
|
|
|
|
|
|
text => '#text', # ok |
37
|
|
|
|
|
|
|
join => '', # ok |
38
|
|
|
|
|
|
|
trim => 1, # ok |
39
|
|
|
|
|
|
|
cdata => undef, # ok + fallback -> text |
40
|
|
|
|
|
|
|
comm => undef, # ok |
41
|
|
|
|
|
|
|
@_ |
42
|
|
|
|
|
|
|
); |
43
|
0
|
|
|
|
|
|
_hash2xml($xml,\%args); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
__END__ |