File Coverage

blib/lib/Data/Serializer/Config/General.pm
Criterion Covered Total %
statement 23 23 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod 3 3 100.0
total 34 34 100.0


line stmt bran cond sub pod time code
1             package Data::Serializer::Config::General;
2 11     11   613 BEGIN { @Data::Serializer::Config::General::ISA = qw(Data::Serializer) }
3 11     11   80 use warnings;
  11         25  
  11         394  
4 11     11   65 use strict;
  11         26  
  11         351  
5 11     11   114 use Config::General;
  11         81  
  11         686  
6 11     11   72 use vars qw($VERSION @ISA);
  11         39  
  11         2772  
7              
8             $VERSION = '0.02';
9             sub options {
10 176     176 1 1010 return (shift)->{options};
11             }
12              
13             sub serialize {
14 88     88 1 158 my $self = (shift);
15 88         146 my $ref = (shift);
16 88         153 return (new Config::General(%{$self->options()}, -ConfigHash => $ref))->save_string();
  88         184  
17             }
18              
19             sub deserialize {
20 88     88 1 175 my $self = (shift);
21 88         152 my $ref = (shift);
22 88         157 my %hash = (new Config::General(%{$self->options()}, -String => $ref))->getall();
  88         195  
23 88         66826 return \%hash;
24             }
25              
26             1;
27              
28             __END__
29              
30             =head1 NAME
31              
32             Data::Serializer::Config::General - Creates bridge between Data::Serializer and Config::General
33              
34             =head1 SYNOPSIS
35              
36             use Data::Serializer::Config::General;
37              
38             =head1 DESCRIPTION
39              
40             Module is used internally to Data::Serializer
41              
42             =head1 METHODS
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             =item B<options> - Pass options through to underlying serializer
51              
52              
53             =back
54              
55             =head1 CAVEAT
56              
57             Base data structure to serialize must be a hash reference
58              
59             =head1 AUTHOR
60              
61             Thomas Linden <tom@daemon.de>
62              
63             =head1 COPYRIGHT
64              
65             Copyright 2002 by Thomas Linden. All rights reserved.
66             This program is free software; you can redistribute it
67             and/or modify it under the same terms as Perl itself.
68              
69             =head1 SEE ALSO
70              
71             perl(1), Data::Serializer(3), Config::General(3)
72              
73             =cut