File Coverage

blib/lib/DBI/Gofer/Serializer/DataDumper.pm
Criterion Covered Total %
statement 12 23 52.1
branch 0 2 0.0
condition n/a
subroutine 4 5 80.0
pod 0 1 0.0
total 16 31 51.6


line stmt bran cond sub pod time code
1             package DBI::Gofer::Serializer::DataDumper;
2              
3 56     56   376 use strict;
  56         125  
  56         1630  
4 56     56   304 use warnings;
  56         115  
  56         2618  
5              
6             our $VERSION = "0.009950";
7              
8             # $Id: DataDumper.pm 9949 2007-09-18 09:38:15Z Tim $
9             #
10             # Copyright (c) 2007, Tim Bunce, Ireland
11             #
12             # You may distribute under the terms of either the GNU General Public
13             # License or the Artistic License, as specified in the Perl README file.
14              
15             =head1 NAME
16              
17             DBI::Gofer::Serializer::DataDumper - Gofer serialization using DataDumper
18              
19             =head1 SYNOPSIS
20              
21             $serializer = DBI::Gofer::Serializer::DataDumper->new();
22              
23             $string = $serializer->serialize( $data );
24              
25             =head1 DESCRIPTION
26              
27             Uses DataDumper to serialize. Deserialization is not supported.
28             The output of this class is only meant for human consumption.
29              
30             See also L.
31              
32             =cut
33              
34 56     56   22116 use Data::Dumper;
  56         259376  
  56         3685  
35              
36 56     56   414 use base qw(DBI::Gofer::Serializer::Base);
  56         120  
  56         10916  
37              
38              
39             sub serialize {
40 0     0 0   my $self = shift;
41 0           local $Data::Dumper::Indent = 1;
42 0           local $Data::Dumper::Terse = 1;
43 0           local $Data::Dumper::Useqq = 0; # enabling this disables xs
44 0           local $Data::Dumper::Sortkeys = 1;
45 0           local $Data::Dumper::Quotekeys = 0;
46 0           local $Data::Dumper::Deparse = 0;
47 0           local $Data::Dumper::Purity = 0;
48 0           my $frozen = Data::Dumper::Dumper(shift);
49 0 0         return $frozen unless wantarray;
50 0           return ($frozen, $self->{deserializer_class});
51             }
52              
53             1;