line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Serializer::Data::Dumper; |
2
|
11
|
|
|
11
|
|
605
|
BEGIN { @Data::Serializer::Data::Dumper::ISA = qw(Data::Serializer) } |
3
|
|
|
|
|
|
|
|
4
|
11
|
|
|
11
|
|
107
|
use warnings; |
|
11
|
|
|
|
|
35
|
|
|
11
|
|
|
|
|
406
|
|
5
|
11
|
|
|
11
|
|
67
|
use strict; |
|
11
|
|
|
|
|
25
|
|
|
11
|
|
|
|
|
297
|
|
6
|
11
|
|
|
11
|
|
68
|
use Carp; |
|
11
|
|
|
|
|
22
|
|
|
11
|
|
|
|
|
774
|
|
7
|
11
|
|
|
11
|
|
76
|
use Data::Dumper; |
|
11
|
|
|
|
|
24
|
|
|
11
|
|
|
|
|
638
|
|
8
|
|
|
|
|
|
|
|
9
|
11
|
|
|
11
|
|
75
|
use vars qw($VERSION @ISA); |
|
11
|
|
|
|
|
21
|
|
|
11
|
|
|
|
|
3733
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
$VERSION = '0.05'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# |
16
|
|
|
|
|
|
|
# Create a Data::Dumper serializer object. |
17
|
|
|
|
|
|
|
# |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub serialize { |
20
|
231
|
|
|
231
|
1
|
487
|
my $self = shift; |
21
|
231
|
|
|
|
|
540
|
my ($val) = @_; |
22
|
231
|
50
|
|
|
|
622
|
return undef unless defined $val; |
23
|
|
|
|
|
|
|
|
24
|
231
|
|
|
|
|
497
|
local $Data::Dumper::Indent = 0; |
25
|
231
|
|
|
|
|
418
|
local $Data::Dumper::Purity = 1; |
26
|
231
|
|
|
|
|
400
|
local $Data::Dumper::Terse = 1; |
27
|
|
|
|
|
|
|
#return Data::Dumper::Dumper($val); |
28
|
|
|
|
|
|
|
#Eval'ing this statement will leave $M defined |
29
|
231
|
|
|
|
|
1399
|
return Data::Dumper->Dump([$val],['M']); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# |
34
|
|
|
|
|
|
|
# |
35
|
|
|
|
|
|
|
# Shamelessly copied from Data::Dumper::Serializer::Data::Dumper |
36
|
|
|
|
|
|
|
# With apologies to relevant parties for not getting the |
37
|
|
|
|
|
|
|
# self-referencing right the first time |
38
|
|
|
|
|
|
|
# |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub deserialize { |
41
|
231
|
|
|
231
|
1
|
452
|
my $self = shift; |
42
|
231
|
|
|
|
|
544
|
my ($val) = @_; |
43
|
231
|
50
|
|
|
|
593
|
return undef unless defined $val; |
44
|
231
|
|
|
|
|
429
|
my $M = ""; |
45
|
|
|
|
|
|
|
# Disambiguate hashref (perl may treat it as a block) |
46
|
231
|
100
|
|
|
|
16146
|
my $N = eval($val =~ /^\{/ ? '+'.$val : $val); |
47
|
231
|
100
|
|
|
|
1793
|
return $M ? $M : $N unless $@; |
|
|
50
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
carp "Data::Serializer error: $@\twhile evaluating:\n $val"; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# avoid used only once warnings |
52
|
|
|
|
|
|
|
{ |
53
|
|
|
|
|
|
|
local $Data::Dumper::Terse; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
__END__ |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 NAME |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Data::Serializer::Data::Dumper - Creates bridge between Data::Serializer and Data::Dumper |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 SYNOPSIS |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
use Data::Serializer::Data::Dumper; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 DESCRIPTION |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Module is used internally to Data::Serializer |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 METHODS |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=over 4 |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item B<serialize> - Wrapper to normalize serializer method name |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item B<deserialize> - Wrapper to normalize deserializer method name |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=back |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 AUTHOR |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Neil Neely <neil@neely.cx> |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 COPYRIGHT |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Copyright 2001 by Neil Neely. All rights reserved. |
91
|
|
|
|
|
|
|
This program is free software; you can redistribute it |
92
|
|
|
|
|
|
|
and/or modify it under the same terms as Perl itself. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 SEE ALSO |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
perl(1), Data::Serializer(3), Data::Dumper(3). |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
99
|
|
|
|
|
|
|
|