File Coverage

blib/lib/Data/Serializer/XML/Simple.pm
Criterion Covered Total %
statement 23 23 100.0
branch 2 4 50.0
condition n/a
subroutine 7 7 100.0
pod 2 2 100.0
total 34 36 94.4


line stmt bran cond sub pod time code
1             package Data::Serializer::XML::Simple;
2 11     11   622 BEGIN { @Data::Serializer::XML::Simple::ISA = qw(Data::Serializer) }
3              
4 11     11   86 use warnings;
  11         26  
  11         389  
5 11     11   64 use strict;
  11         24  
  11         308  
6 11     11   69 use XML::Simple qw();
  11         24  
  11         279  
7 11     11   59 use vars qw($VERSION @ISA);
  11         29  
  11         2991  
8              
9             $VERSION = '0.03';
10              
11              
12             sub serialize {
13 126     126 1 250 my $self = (shift);
14 126 50       453 my %options = ref $self->{options} eq 'HASH' ? %{$self->{options}}: ();
  126         372  
15 126         1008 my $xml = XML::Simple->new(keyattr => [ 'name'], %options);
16 126         8990 return $xml->XMLout( (shift) );
17             }
18              
19             sub deserialize {
20 126     126 1 243 my $self = (shift);
21 126 50       387 my %options = ref $self->{options} eq 'HASH' ? %{$self->{options}}: ();
  126         343  
22 126         742 my $xml = XML::Simple->new(keyattr => [ 'name'], %options);
23 126         8132 return $xml->XMLin( (shift) );
24             }
25              
26             1;
27             __END__
28             #
29              
30             =head1 NAME
31              
32             Data::Serializer::XML::Simple - Creates bridge between Data::Serializer and XML::Simple
33              
34             =head1 SYNOPSIS
35              
36             use Data::Serializer::XML::Simple;
37              
38             =head1 DESCRIPTION
39              
40             Module is used internally to Data::Serializer
41              
42             Any options are passed through to XML::Simple. See XML::Simple(3) for details.
43              
44             =over 4
45              
46             =item B<serialize> - Wrapper to normalize serializer method name
47              
48             =item B<deserialize> - Wrapper to normalize deserializer method name
49              
50             =back
51              
52             =head1 AUTHOR
53            
54             Neil Neely <neil@neely.cx>
55            
56             =head1 COPYRIGHT
57            
58             Copyright 2004 by Neil Neely. All rights reserved.
59             This program is free software; you can redistribute it
60             and/or modify it under the same terms as Perl itself.
61            
62             =head1 SEE ALSO
63              
64             perl(1), Data::Serializer(3), XML::Simple(3).
65              
66             =cut
67              
68