line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Object::Role::Dumpable; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
292528
|
use 5.014; |
|
1
|
|
|
|
|
4
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
93
|
|
6
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
27
|
|
7
|
1
|
|
|
1
|
|
5
|
use routines; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
1708
|
use Moo::Role; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
7
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '2.01'; # VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# METHODS |
14
|
|
|
|
|
|
|
|
15
|
7
|
|
|
7
|
1
|
52311
|
method dump() { |
|
7
|
|
|
|
|
11
|
|
16
|
7
|
|
|
|
|
796
|
require Data::Dumper; |
17
|
7
|
|
|
|
|
6821
|
require Data::Object::Utility; |
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
1
|
|
477
|
no warnings 'once'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
127
|
|
20
|
|
|
|
|
|
|
|
21
|
7
|
|
|
|
|
16
|
local $Data::Dumper::Indent = 0; |
22
|
7
|
|
|
|
|
10
|
local $Data::Dumper::Purity = 0; |
23
|
7
|
|
|
|
|
12
|
local $Data::Dumper::Quotekeys = 0; |
24
|
7
|
|
|
|
|
11
|
local $Data::Dumper::Deepcopy = 1; |
25
|
7
|
|
|
|
|
12
|
local $Data::Dumper::Deparse = 1; |
26
|
7
|
|
|
|
|
10
|
local $Data::Dumper::Sortkeys = 1; |
27
|
7
|
|
|
|
|
12
|
local $Data::Dumper::Terse = 1; |
28
|
7
|
|
|
|
|
11
|
local $Data::Dumper::Useqq = 1; |
29
|
|
|
|
|
|
|
|
30
|
7
|
|
|
|
|
19
|
my $data = Data::Dumper::Dumper($self); |
31
|
|
|
|
|
|
|
|
32
|
7
|
|
|
|
|
363
|
$data =~ s/^"|"$//g; |
33
|
|
|
|
|
|
|
|
34
|
7
|
|
|
|
|
71
|
return $data; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
7
|
|
|
7
|
1
|
13327
|
method pretty_dump() { |
|
7
|
|
|
|
|
22
|
|
38
|
7
|
|
|
|
|
32
|
require Data::Dumper; |
39
|
7
|
|
|
|
|
22
|
require Data::Object::Utility; |
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
1
|
|
83
|
no warnings 'once'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
214
|
|
42
|
|
|
|
|
|
|
|
43
|
7
|
|
|
|
|
15
|
local $Data::Dumper::Indent = 2; |
44
|
7
|
|
|
|
|
10
|
local $Data::Dumper::Trailingcomma = 0; |
45
|
7
|
|
|
|
|
11
|
local $Data::Dumper::Purity = 0; |
46
|
7
|
|
|
|
|
12
|
local $Data::Dumper::Pad = ''; |
47
|
7
|
|
|
|
|
11
|
local $Data::Dumper::Varname = 'VAR'; |
48
|
7
|
|
|
|
|
11
|
local $Data::Dumper::Useqq = 0; |
49
|
7
|
|
|
|
|
12
|
local $Data::Dumper::Terse = 1; |
50
|
7
|
|
|
|
|
9
|
local $Data::Dumper::Freezer = ''; |
51
|
7
|
|
|
|
|
12
|
local $Data::Dumper::Toaster = ''; |
52
|
7
|
|
|
|
|
9
|
local $Data::Dumper::Deepcopy = 1; |
53
|
7
|
|
|
|
|
11
|
local $Data::Dumper::Quotekeys = 0; |
54
|
7
|
|
|
|
|
12
|
local $Data::Dumper::Bless = 'bless'; |
55
|
7
|
|
|
|
|
10
|
local $Data::Dumper::Pair = ' => '; |
56
|
7
|
|
|
|
|
11
|
local $Data::Dumper::Maxdepth = 0; |
57
|
7
|
|
|
|
|
11
|
local $Data::Dumper::Maxrecurse = 1000; |
58
|
7
|
|
|
|
|
10
|
local $Data::Dumper::Useperl = 0; |
59
|
7
|
|
|
|
|
10
|
local $Data::Dumper::Sortkeys = 1; |
60
|
7
|
|
|
|
|
11
|
local $Data::Dumper::Deparse = 1; |
61
|
7
|
|
|
|
|
9
|
local $Data::Dumper::Sparseseen = 0; |
62
|
|
|
|
|
|
|
|
63
|
7
|
|
|
|
|
20
|
my $data = Data::Dumper::Dumper($self); |
64
|
|
|
|
|
|
|
|
65
|
7
|
|
|
|
|
437
|
$data =~ s/^'|'$//g; |
66
|
|
|
|
|
|
|
|
67
|
7
|
|
|
|
|
18
|
chomp $data; |
68
|
|
|
|
|
|
|
|
69
|
7
|
|
|
|
|
52
|
return $data; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
2
|
|
|
2
|
1
|
16099
|
method pretty_print(@args) { |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
2
|
|
73
|
|
|
|
|
|
|
|
74
|
2
|
|
|
|
|
7
|
return $self->printer(map &pretty_dump($_), $self, @args); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
2
|
|
|
2
|
1
|
15500
|
method pretty_say(@args) { |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
4
|
|
78
|
|
|
|
|
|
|
|
79
|
2
|
|
|
|
|
8
|
return $self->printer(map +(&pretty_dump($_), "\n"), $self, @args); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
2
|
|
|
2
|
1
|
15429
|
method print(@args) { |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
5
|
|
83
|
|
|
|
|
|
|
|
84
|
2
|
|
|
|
|
9
|
return $self->printer(map &dump($_), $self, @args); |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
0
|
0
|
0
|
method printer(@args) { |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
88
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
0
|
return CORE::print(@args); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
2
|
|
|
2
|
1
|
16036
|
method say(@args) { |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
3
|
|
93
|
|
|
|
|
|
|
|
94
|
2
|
|
|
|
|
8
|
return $self->printer(map +(&dump($_), "\n"), $self, @args); |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=encoding utf8 |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 NAME |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Data::Object::Role::Dumpable |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=cut |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 ABSTRACT |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Dumpable Role for Perl 5 |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=cut |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 SYNOPSIS |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
package Example; |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
use Moo; |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
with 'Data::Object::Role::Dumpable'; |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
package main; |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
my $example = Example->new; |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
# $example->dump |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=cut |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 DESCRIPTION |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
This package provides methods for dumping the object and underlying value. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=cut |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 METHODS |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
This package implements the following methods: |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=cut |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head2 dump |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
dump() : Str |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
The dump method returns a string representation of the underlying data. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=over 4 |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=item dump example #1 |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
# given: synopsis |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
my $dumped = $example->dump; |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=back |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=cut |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head2 pretty_dump |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
pretty_dump() : Str |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
The pretty_dump method returns a string representation of the underlying data |
164
|
|
|
|
|
|
|
that is human-readable and useful for debugging. |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=over 4 |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=item pretty_dump example #1 |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
# given: synopsis |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
my $dumped = $example->pretty_dump; |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=back |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=cut |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head2 pretty_print |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
pretty_print(Any @args) : Int |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
The pretty_print method prints a stringified human-readable representation of |
183
|
|
|
|
|
|
|
the underlying data. |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=over 4 |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=item pretty_print example #1 |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
# given: synopsis |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
my $printed = $example->pretty_print; |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=back |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=over 4 |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=item pretty_print example #2 |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
# given: synopsis |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
my $printed = $example->pretty_print({1..4}); |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=back |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=cut |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=head2 pretty_say |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
pretty_say(Any @args) : Int |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
The pretty_say method prints a stringified human-readable representation of the |
212
|
|
|
|
|
|
|
underlying data, with a trailing newline. |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=over 4 |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=item pretty_say example #1 |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
# given: synopsis |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
my $printed = $example->pretty_say; |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=back |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=over 4 |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=item pretty_say example #2 |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
# given: synopsis |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
my $printed = $example->pretty_say({1..4}); |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=back |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=cut |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=head2 print |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
print(Any @args) : Int |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
The print method prints a stringified representation of the underlying data. |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=over 4 |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=item print example #1 |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
# given: synopsis |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
my $printed = $example->print; |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=back |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
=over 4 |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
=item print example #2 |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
# given: synopsis |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
my $printed = $example->print({1..4}); |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
=back |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
=cut |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
=head2 say |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
say(Any @args) : Int |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
The say method prints a stringified representation of the underlying data, with |
269
|
|
|
|
|
|
|
a trailing newline. |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
=over 4 |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
=item say example #1 |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
# given: synopsis |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
my $printed = $example->say; |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=back |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=over 4 |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
=item say example #2 |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
# given: synopsis |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
my $printed = $example->say({1..4}); |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
=back |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
=cut |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
=head1 AUTHOR |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
Al Newkirk, C |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
=head1 LICENSE |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
Copyright (C) 2011-2019, Al Newkirk, et al. |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under the terms |
302
|
|
|
|
|
|
|
of the The Apache License, Version 2.0, as elucidated in the L<"license |
303
|
|
|
|
|
|
|
file"|https://github.com/iamalnewkirk/data-object-role-dumpable/blob/master/LICENSE>. |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
=head1 PROJECT |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
L |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
L |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
L |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
L |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
L |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
L |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
=cut |