| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Data::Record::Serialize::Encode::ddump; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: encoded a record using Data::Dumper |
|
4
|
|
|
|
|
|
|
|
|
5
|
7
|
|
|
7
|
|
260724
|
use v5.12; |
|
|
7
|
|
|
|
|
36
|
|
|
6
|
7
|
|
|
7
|
|
667
|
use Moo::Role; |
|
|
7
|
|
|
|
|
19282
|
|
|
|
7
|
|
|
|
|
61
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '2.02'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
7
|
|
|
7
|
|
4658
|
use Scalar::Util; |
|
|
7
|
|
|
|
|
23
|
|
|
|
7
|
|
|
|
|
458
|
|
|
11
|
7
|
|
|
7
|
|
3030
|
use Data::Dumper; |
|
|
7
|
|
|
|
|
40286
|
|
|
|
7
|
|
|
|
|
755
|
|
|
12
|
7
|
|
|
7
|
|
638
|
use Data::Record::Serialize::Error { errors => ['::parameter'] }, -all; |
|
|
7
|
|
|
|
|
31
|
|
|
|
7
|
|
|
|
|
154
|
|
|
13
|
7
|
|
|
7
|
|
2262
|
use namespace::clean; |
|
|
7
|
|
|
|
|
20569
|
|
|
|
7
|
|
|
|
|
86
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
29
|
|
|
29
|
|
246
|
sub _needs_eol { 1 } |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has ddump => ( |
|
25
|
|
|
|
|
|
|
is => 'lazy', |
|
26
|
|
|
|
|
|
|
isa => sub { Scalar::Util::blessed $_[0] && $_[0]->isa( 'Data::Dumper' ) }, |
|
27
|
|
|
|
|
|
|
builder => sub { |
|
28
|
19
|
|
|
19
|
|
423
|
Data::Dumper->new( [] ); |
|
29
|
|
|
|
|
|
|
}, |
|
30
|
|
|
|
|
|
|
); |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
has dd_config => ( |
|
45
|
|
|
|
|
|
|
is => 'ro', |
|
46
|
|
|
|
|
|
|
isa => sub { |
|
47
|
|
|
|
|
|
|
ref $_[0] eq 'HASH' |
|
48
|
|
|
|
|
|
|
or error( '::parameter' => q{'config' parameter must be a hashref'} ); |
|
49
|
|
|
|
|
|
|
}, |
|
50
|
|
|
|
|
|
|
default => sub { {} }, |
|
51
|
|
|
|
|
|
|
); |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub encode { |
|
59
|
29
|
|
|
29
|
0
|
63
|
my $self = shift; |
|
60
|
29
|
|
|
|
|
696
|
$self->ddump->Values( \@_ )->Dump . q{,}; |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
around BUILD => sub { |
|
64
|
|
|
|
|
|
|
my ( $orig, $self ) = ( shift, shift ); |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
$orig->( $self, @_ ); |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
my $ddump = $self->ddump; |
|
69
|
|
|
|
|
|
|
my %config = ( |
|
70
|
|
|
|
|
|
|
%{ $self->dd_config }, |
|
71
|
|
|
|
|
|
|
Terse => 1, |
|
72
|
|
|
|
|
|
|
Trailingcomma => 1, |
|
73
|
|
|
|
|
|
|
); |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
for my $mth ( keys %config ) { |
|
76
|
|
|
|
|
|
|
my $code = $ddump->can( $mth ) |
|
77
|
|
|
|
|
|
|
or error( '::parameter', "$mth is not a Data::Dumper configuration variable" ); |
|
78
|
|
|
|
|
|
|
$code->( $ddump, $config{$mth} ); |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
return; |
|
81
|
|
|
|
|
|
|
}; |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
with 'Data::Record::Serialize::Role::Encode'; |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
1; |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
# |
|
95
|
|
|
|
|
|
|
# This file is part of Data-Record-Serialize |
|
96
|
|
|
|
|
|
|
# |
|
97
|
|
|
|
|
|
|
# This software is Copyright (c) 2017 by Smithsonian Astrophysical Observatory. |
|
98
|
|
|
|
|
|
|
# |
|
99
|
|
|
|
|
|
|
# This is free software, licensed under: |
|
100
|
|
|
|
|
|
|
# |
|
101
|
|
|
|
|
|
|
# The GNU General Public License, Version 3, June 2007 |
|
102
|
|
|
|
|
|
|
# |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
__END__ |