File Coverage

blib/lib/XML/Fast.pm
Criterion Covered Total %
statement 23 26 88.4
branch n/a
condition n/a
subroutine 8 9 88.8
pod 2 2 100.0
total 33 37 89.1


line stmt bran cond sub pod time code
1             package XML::Fast;
2              
3 6     6   133962 use 5.008008;
  6         29  
4 6     6   47 use strict;
  6         15  
  6         179  
5 6     6   40 use warnings;no warnings 'uninitialized';
  6     6   21  
  6         309  
  6         42  
  6         16  
  6         262  
6 6     6   3536 use Encode;
  6         67446  
  6         574  
7              
8 6     6   55 use base 'Exporter';
  6         13  
  6         1721  
9             our @EXPORT_OK = our @EXPORT = qw( xml2hash hash2xml );
10              
11             our $VERSION = '0.16';
12              
13 6     6   52 use XSLoader;
  6         15  
  6         2111  
14             XSLoader::load('XML::Fast', $VERSION);
15              
16             sub xml2hash($;%) {
17 52     52 1 32388 my $xml = shift;
18 52         287 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         6697 _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__