line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Encoder::Data::Dumper; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
370
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
5
|
1
|
|
|
1
|
|
3
|
use Carp (); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
9
|
|
6
|
1
|
|
|
1
|
|
6
|
use Data::Dumper (); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
146
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
2
|
|
|
2
|
0
|
994
|
my ($class, $args) = @_; |
10
|
2
|
|
100
|
|
|
8
|
$args ||= {}; |
11
|
2
|
|
|
|
|
7
|
bless { %$args }, __PACKAGE__; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub encode { |
15
|
2
|
|
|
2
|
0
|
9
|
my ($self, $stuff, @args) = @_; |
16
|
2
|
|
|
|
|
3
|
local $Data::Dumper::Terse = 1; |
17
|
2
|
|
|
|
|
3
|
local $Data::Dumper::Purity = 1; |
18
|
2
|
|
|
|
|
1
|
local $Data::Dumper::Indent = 0; |
19
|
2
|
|
|
|
|
9
|
my $dumper = Data::Dumper->new([$stuff], @args); |
20
|
2
|
|
|
|
|
49
|
for my $method (keys %$self) { |
21
|
1
|
|
|
|
|
5
|
$dumper->$method($self->{$method}); |
22
|
|
|
|
|
|
|
} |
23
|
2
|
|
|
|
|
12
|
return $dumper->Dump; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub decode { |
27
|
2
|
|
|
2
|
0
|
706
|
my ($self, $stuff, @args) = @_; |
28
|
2
|
|
|
|
|
1
|
local $@; |
29
|
2
|
|
|
|
|
92
|
my $res = eval $stuff; ## no critic |
30
|
2
|
50
|
|
|
|
7
|
Carp::croak $@ if $@; |
31
|
2
|
|
|
|
|
9
|
return $res; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
__END__ |