line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Venus::Role::Dumpable; |
2
|
|
|
|
|
|
|
|
3
|
87
|
|
|
87
|
|
1474
|
use 5.018; |
|
87
|
|
|
|
|
310
|
|
4
|
|
|
|
|
|
|
|
5
|
87
|
|
|
87
|
|
446
|
use strict; |
|
87
|
|
|
|
|
187
|
|
|
87
|
|
|
|
|
1830
|
|
6
|
87
|
|
|
87
|
|
445
|
use warnings; |
|
87
|
|
|
|
|
219
|
|
|
87
|
|
|
|
|
2516
|
|
7
|
|
|
|
|
|
|
|
8
|
87
|
|
|
87
|
|
533
|
use Venus::Role 'with'; |
|
87
|
|
|
|
|
248
|
|
|
87
|
|
|
|
|
535
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# METHODS |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub dump { |
13
|
1746
|
|
|
1746
|
1
|
4055
|
my ($self, $method, @args) = @_; |
14
|
|
|
|
|
|
|
|
15
|
1746
|
|
|
|
|
7150
|
require Data::Dumper; |
16
|
|
|
|
|
|
|
|
17
|
87
|
|
|
87
|
|
689
|
no warnings 'once'; |
|
87
|
|
|
|
|
223
|
|
|
87
|
|
|
|
|
21779
|
|
18
|
|
|
|
|
|
|
|
19
|
1746
|
|
|
|
|
3388
|
local $Data::Dumper::Indent = 0; |
20
|
1746
|
|
|
|
|
2597
|
local $Data::Dumper::Purity = 0; |
21
|
1746
|
|
|
|
|
2642
|
local $Data::Dumper::Quotekeys = 0; |
22
|
1746
|
|
|
|
|
2553
|
local $Data::Dumper::Deepcopy = 1; |
23
|
1746
|
|
|
|
|
2374
|
local $Data::Dumper::Deparse = 1; |
24
|
1746
|
|
|
|
|
2832
|
local $Data::Dumper::Sortkeys = 1; |
25
|
1746
|
|
|
|
|
2496
|
local $Data::Dumper::Terse = 1; |
26
|
1746
|
|
|
|
|
2520
|
local $Data::Dumper::Useqq = 1; |
27
|
|
|
|
|
|
|
|
28
|
1746
|
|
|
|
|
2681
|
local $_ = $self; |
29
|
|
|
|
|
|
|
|
30
|
1746
|
100
|
|
|
|
6217
|
my $data = Data::Dumper->Dump([ |
31
|
|
|
|
|
|
|
$method ? scalar($self->$method(@args)) : $self |
32
|
|
|
|
|
|
|
]); |
33
|
|
|
|
|
|
|
|
34
|
1746
|
|
|
|
|
195026
|
$data =~ s/^"|"$//g; |
35
|
|
|
|
|
|
|
|
36
|
1746
|
|
|
|
|
11470
|
return $data; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub dump_pretty { |
40
|
5
|
|
|
5
|
1
|
18
|
my ($self, $method, @args) = @_; |
41
|
|
|
|
|
|
|
|
42
|
5
|
|
|
|
|
23
|
require Data::Dumper; |
43
|
|
|
|
|
|
|
|
44
|
87
|
|
|
87
|
|
744
|
no warnings 'once'; |
|
87
|
|
|
|
|
267
|
|
|
87
|
|
|
|
|
27661
|
|
45
|
|
|
|
|
|
|
|
46
|
5
|
|
|
|
|
15
|
local $Data::Dumper::Indent = 2; |
47
|
5
|
|
|
|
|
10
|
local $Data::Dumper::Trailingcomma = 0; |
48
|
5
|
|
|
|
|
9
|
local $Data::Dumper::Purity = 0; |
49
|
5
|
|
|
|
|
10
|
local $Data::Dumper::Pad = ''; |
50
|
5
|
|
|
|
|
12
|
local $Data::Dumper::Varname = 'VAR'; |
51
|
5
|
|
|
|
|
10
|
local $Data::Dumper::Useqq = 0; |
52
|
5
|
|
|
|
|
11
|
local $Data::Dumper::Terse = 1; |
53
|
5
|
|
|
|
|
10
|
local $Data::Dumper::Freezer = ''; |
54
|
5
|
|
|
|
|
8
|
local $Data::Dumper::Toaster = ''; |
55
|
5
|
|
|
|
|
12
|
local $Data::Dumper::Deepcopy = 1; |
56
|
5
|
|
|
|
|
9
|
local $Data::Dumper::Quotekeys = 0; |
57
|
5
|
|
|
|
|
11
|
local $Data::Dumper::Bless = 'bless'; |
58
|
5
|
|
|
|
|
9
|
local $Data::Dumper::Pair = ' => '; |
59
|
5
|
|
|
|
|
10
|
local $Data::Dumper::Maxdepth = 0; |
60
|
5
|
|
|
|
|
10
|
local $Data::Dumper::Maxrecurse = 1000; |
61
|
5
|
|
|
|
|
7
|
local $Data::Dumper::Useperl = 0; |
62
|
5
|
|
|
|
|
10
|
local $Data::Dumper::Sortkeys = 1; |
63
|
5
|
|
|
|
|
10
|
local $Data::Dumper::Deparse = 1; |
64
|
5
|
|
|
|
|
8
|
local $Data::Dumper::Sparseseen = 0; |
65
|
|
|
|
|
|
|
|
66
|
5
|
|
|
|
|
12
|
local $_ = $self; |
67
|
|
|
|
|
|
|
|
68
|
5
|
100
|
|
|
|
53
|
my $data = Data::Dumper->Dump([ |
69
|
|
|
|
|
|
|
$method ? scalar($self->$method(@args)) : $self |
70
|
|
|
|
|
|
|
]); |
71
|
|
|
|
|
|
|
|
72
|
5
|
|
|
|
|
348
|
$data =~ s/^'|'$//g; |
73
|
|
|
|
|
|
|
|
74
|
5
|
|
|
|
|
24
|
chomp $data; |
75
|
|
|
|
|
|
|
|
76
|
5
|
|
|
|
|
105
|
return $data; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
# EXPORTS |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub EXPORT { |
82
|
90
|
|
|
90
|
0
|
367
|
['dump', 'dump_pretty'] |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 NAME |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Venus::Role::Dumpable - Dumpable Role |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=cut |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 ABSTRACT |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Dumpable Role for Perl 5 |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=cut |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 SYNOPSIS |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
package Example; |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
use Venus::Class; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
attr 'test'; |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
with 'Venus::Role::Dumpable'; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
package main; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
my $example = Example->new(test => 123); |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
# $example->dump; |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=cut |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 DESCRIPTION |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
This package modifies the consuming package and provides methods for dumping |
122
|
|
|
|
|
|
|
the object or the return value of a dispatched method call. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=cut |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 METHODS |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
This package provides the following methods: |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=cut |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head2 dump |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
dump(Str | CodeRef $method, Any @args) (Str) |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
The dump method returns a string representation of the underlying data. This |
137
|
|
|
|
|
|
|
method supports dispatching, i.e. providing a method name and arguments whose |
138
|
|
|
|
|
|
|
return value will be acted on by this method. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
I> |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=over 4 |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=item dump example 1 |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
package main; |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
my $example = Example->new(test => 123); |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
my $dump = $example->dump; |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
# "bless( {test => 123}, 'Example' )" |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=back |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=cut |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head2 dump_pretty |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
dump_pretty(Str | CodeRef $method, Any @args) (Str) |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
The dump_pretty method returns a string representation of the underlying data |
163
|
|
|
|
|
|
|
that is human-readable and useful for debugging. This method supports |
164
|
|
|
|
|
|
|
dispatching, i.e. providing a method name and arguments whose return value will |
165
|
|
|
|
|
|
|
be acted on by this method. |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
I> |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=over 4 |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=item dump_pretty example 1 |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
package main; |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
my $example = Example->new(test => 123); |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
my $dump_pretty = $example->dump_pretty; |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
# bless( { |
180
|
|
|
|
|
|
|
# test => 123 |
181
|
|
|
|
|
|
|
# }, 'Example' ) |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=back |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=cut |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head1 AUTHORS |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Awncorp, C |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=cut |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head1 LICENSE |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Copyright (C) 2000, Al Newkirk. |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
This program is free software, you can redistribute it and/or modify it under |
198
|
|
|
|
|
|
|
the terms of the Apache license version 2.0. |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=cut |