| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
# ABSTRACT: encoded a record using Data::Dumper |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
use Moo::Role; |
|
5
|
6
|
|
|
6
|
|
2995
|
|
|
|
6
|
|
|
|
|
14
|
|
|
|
6
|
|
|
|
|
40
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '1.03'; # TRIAL |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use Scalar::Util; |
|
9
|
6
|
|
|
6
|
|
2331
|
use Data::Dumper; |
|
|
6
|
|
|
|
|
110
|
|
|
|
6
|
|
|
|
|
315
|
|
|
10
|
6
|
|
|
6
|
|
1594
|
use Data::Record::Serialize::Error { errors => ['::parameter'] }, -all; |
|
|
6
|
|
|
|
|
16459
|
|
|
|
6
|
|
|
|
|
431
|
|
|
11
|
6
|
|
|
6
|
|
47
|
use namespace::clean; |
|
|
6
|
|
|
|
|
12
|
|
|
|
6
|
|
|
|
|
94
|
|
|
12
|
6
|
|
|
6
|
|
852
|
|
|
|
6
|
|
|
|
|
12
|
|
|
|
6
|
|
|
|
|
55
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
28
|
|
|
28
|
|
98
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has ddump => ( |
|
22
|
|
|
|
|
|
|
is => 'lazy', |
|
23
|
|
|
|
|
|
|
isa => sub { Scalar::Util::blessed $_[0] && $_[0]->isa( 'Data::Dumper' ) }, |
|
24
|
|
|
|
|
|
|
builder => sub { |
|
25
|
|
|
|
|
|
|
Data::Dumper->new( [] ); |
|
26
|
|
|
|
|
|
|
}, |
|
27
|
18
|
|
|
18
|
|
267
|
); |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
has dd_config => ( |
|
42
|
|
|
|
|
|
|
is => 'ro', |
|
43
|
|
|
|
|
|
|
isa => sub { |
|
44
|
|
|
|
|
|
|
ref $_[0] eq 'HASH' |
|
45
|
|
|
|
|
|
|
or error( '::parameter' => q{'config' parameter must be a hashref'} ); |
|
46
|
|
|
|
|
|
|
}, |
|
47
|
|
|
|
|
|
|
default => sub { {} }, |
|
48
|
|
|
|
|
|
|
); |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
my $self = shift; |
|
56
|
|
|
|
|
|
|
$self->ddump->Values( \@_ )->Dump . ","; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
28
|
|
|
28
|
0
|
60
|
|
|
59
|
28
|
|
|
|
|
366
|
around BUILD => sub { |
|
60
|
|
|
|
|
|
|
my ( $orig, $self) = ( shift, shift ); |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
$orig->( $self, @_); |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
my $ddump = $self->ddump; |
|
65
|
|
|
|
|
|
|
my %config = ( |
|
66
|
|
|
|
|
|
|
%{ $self->dd_config }, |
|
67
|
|
|
|
|
|
|
Terse => 1, |
|
68
|
|
|
|
|
|
|
Trailingcomma => 1 |
|
69
|
|
|
|
|
|
|
); |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
for my $mth ( keys %config ) { |
|
72
|
|
|
|
|
|
|
my $code = $ddump->can( $mth ) |
|
73
|
|
|
|
|
|
|
or error( '::parameter', "$mth is not a Data::Dumper configuration variable" ); |
|
74
|
|
|
|
|
|
|
$code->( $ddump, $config{$mth}); |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
return; |
|
77
|
|
|
|
|
|
|
}; |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
with 'Data::Record::Serialize::Role::Encode'; |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
# |
|
91
|
|
|
|
|
|
|
# This file is part of Data-Record-Serialize |
|
92
|
|
|
|
|
|
|
# |
|
93
|
|
|
|
|
|
|
# This software is Copyright (c) 2017 by Smithsonian Astrophysical Observatory. |
|
94
|
|
|
|
|
|
|
# |
|
95
|
|
|
|
|
|
|
# This is free software, licensed under: |
|
96
|
|
|
|
|
|
|
# |
|
97
|
|
|
|
|
|
|
# The GNU General Public License, Version 3, June 2007 |
|
98
|
|
|
|
|
|
|
# |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=pod |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=for :stopwords Diab Jerius Smithsonian Astrophysical Observatory Trailingcomma |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 NAME |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Data::Record::Serialize::Encode::ddump - encoded a record using Data::Dumper |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 VERSION |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
version 1.03 |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
use Data::Record::Serialize; |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
my $s = Data::Record::Serialize->new( encode => 'ddump', ... ); |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
$s->send( \%record ); |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
B<Data::Record::Serialize::Encode::ddump> encodes a record using |
|
124
|
|
|
|
|
|
|
L<Data::Dumper>. The resultant encoding may be decoded via |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
@data = eval $buf; |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
It performs the L<Data::Record::Serialize::Role::Encode> role. |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 CLASS METHODS |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head2 new |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
This role adds two named arguments to the constructor, L</ddump> and |
|
135
|
|
|
|
|
|
|
L</config>, which mirror the added object attributes. |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head2 ddump |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
The L<Data::Dumper> object. It will be constructed if not provided to |
|
142
|
|
|
|
|
|
|
the constructor. |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head2 dd_config |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Configuration data for the L</ddump> L<Data::Dumper> object. Hash |
|
147
|
|
|
|
|
|
|
keys are the names of L<Data::Dumper> configuration variables, without |
|
148
|
|
|
|
|
|
|
the preceding C<Data::Dumper::> prefix. Be careful to ensure that the |
|
149
|
|
|
|
|
|
|
resultant output is a (comma separated) list of structures which can be |
|
150
|
|
|
|
|
|
|
C<eval>'ed. |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
B<Terse> and B<Trailingcomma> are always set. |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=for Pod::Coverage encode |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head1 SUPPORT |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head2 Bugs |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
Please report any bugs or feature requests to bug-data-record-serialize@rt.cpan.org or through the web interface at: https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Record-Serialize |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head2 Source |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Source is available at |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
https://gitlab.com/djerius/data-record-serialize |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
and may be cloned from |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
https://gitlab.com/djerius/data-record-serialize.git |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Please see those modules/websites for more information related to this module. |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=over 4 |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=item * |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
L<Data::Record::Serialize|Data::Record::Serialize> |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=back |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head1 AUTHOR |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
Diab Jerius <djerius@cpan.org> |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
This software is Copyright (c) 2017 by Smithsonian Astrophysical Observatory. |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
This is free software, licensed under: |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
The GNU General Public License, Version 3, June 2007 |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=cut |