| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Data::Walk::Print; |
|
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:JANDREW'; |
|
3
|
2
|
|
|
2
|
|
1123
|
use version; our $VERSION = version->declare('v0.26.16'); |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
166
|
use Moose::Role; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
|
|
requires |
|
7
|
|
|
|
|
|
|
'_get_had_secondary', |
|
8
|
|
|
|
|
|
|
'_process_the_data', |
|
9
|
|
|
|
|
|
|
'_dispatch_method'; |
|
10
|
2
|
|
|
|
|
15
|
use Types::Standard qw( |
|
11
|
|
|
|
|
|
|
Str |
|
12
|
|
|
|
|
|
|
Bool |
|
13
|
|
|
|
|
|
|
is_HashRef |
|
14
|
|
|
|
|
|
|
is_Num |
|
15
|
2
|
|
|
2
|
|
6548
|
); |
|
|
2
|
|
|
|
|
3
|
|
|
16
|
|
|
|
|
|
|
if( $ENV{ Smart_Comments } ){ |
|
17
|
2
|
|
|
2
|
|
1484
|
use Smart::Comments -ENV; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
16
|
|
|
18
|
|
|
|
|
|
|
### Smart-Comments turned on for Data-Walk-Print ... |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
#########1 Package Variables 3#########4#########5#########6#########7#########8#########9 |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
$| = 1; |
|
24
|
|
|
|
|
|
|
my $print_keys = { |
|
25
|
|
|
|
|
|
|
print_ref => 'primary_ref', |
|
26
|
|
|
|
|
|
|
match_ref => 'secondary_ref', |
|
27
|
|
|
|
|
|
|
}; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
#########1 Dispatch Tables 3#########4#########5#########6#########7#########8#########9 |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $before_pre_string_dispatch ={######<----------------------------- ADD New types here |
|
32
|
|
|
|
|
|
|
HASH => \&_before_hash_pre_string, |
|
33
|
|
|
|
|
|
|
ARRAY => \&_before_array_pre_string, |
|
34
|
|
|
|
|
|
|
DEFAULT => sub{ 0 }, |
|
35
|
|
|
|
|
|
|
name => 'print - before pre string dispatch', |
|
36
|
|
|
|
|
|
|
###### Receives: the current $passed_ref and the last branch_ref array |
|
37
|
|
|
|
|
|
|
###### Returns: nothing |
|
38
|
|
|
|
|
|
|
###### Action: adds the necessary pre string and match string |
|
39
|
|
|
|
|
|
|
###### for the currently pending position |
|
40
|
|
|
|
|
|
|
}; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my $before_method_dispatch ={######<---------------------------------- ADD New types here |
|
44
|
|
|
|
|
|
|
HASH => \&_before_hash_printing, |
|
45
|
|
|
|
|
|
|
ARRAY => \&_before_array_printing, |
|
46
|
|
|
|
|
|
|
OBJECT => \&_before_object_printing, |
|
47
|
|
|
|
|
|
|
DEFAULT => sub{ 0 }, |
|
48
|
|
|
|
|
|
|
name => 'print - before_method_dispatch', |
|
49
|
|
|
|
|
|
|
###### Receives: the passed_ref |
|
50
|
|
|
|
|
|
|
###### Returns: 1|0 if the string should be printed |
|
51
|
|
|
|
|
|
|
###### Action: adds the necessary before string and match string to the currently |
|
52
|
|
|
|
|
|
|
###### pending line |
|
53
|
|
|
|
|
|
|
}; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
my $after_method_dispatch ={######<----------------------------------- ADD New types here |
|
56
|
|
|
|
|
|
|
UNDEF => \&_after_undef_printing, |
|
57
|
|
|
|
|
|
|
SCALAR => \&_after_scalar_printing, |
|
58
|
|
|
|
|
|
|
HASH => \&_after_hash_printing, |
|
59
|
|
|
|
|
|
|
ARRAY => \&_after_array_printing, |
|
60
|
|
|
|
|
|
|
OBJECT => \&_after_object_printing, |
|
61
|
|
|
|
|
|
|
name => 'print - after_method_dispatch', |
|
62
|
|
|
|
|
|
|
###### Receives: the passed_ref |
|
63
|
|
|
|
|
|
|
###### Returns: 1|0 if the string should be printed |
|
64
|
|
|
|
|
|
|
###### Action: adds the necessary after string and match string to the currently |
|
65
|
|
|
|
|
|
|
###### pending line |
|
66
|
|
|
|
|
|
|
}; |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
#########1 Public Attributes 3#########4#########5#########6#########7#########8#########9 |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
has 'match_highlighting' =>( |
|
71
|
|
|
|
|
|
|
is => 'ro', |
|
72
|
|
|
|
|
|
|
isa => Bool, |
|
73
|
|
|
|
|
|
|
writer => 'set_match_highlighting', |
|
74
|
|
|
|
|
|
|
predicate => 'has_match_highlighting', |
|
75
|
|
|
|
|
|
|
reader => 'get_match_highlighting', |
|
76
|
|
|
|
|
|
|
clearer => 'clear_match_highlighting', |
|
77
|
|
|
|
|
|
|
default => 1, |
|
78
|
|
|
|
|
|
|
); |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
has 'to_string' =>( |
|
81
|
|
|
|
|
|
|
is => 'ro', |
|
82
|
|
|
|
|
|
|
isa => Bool, |
|
83
|
|
|
|
|
|
|
reader => 'get_to_string', |
|
84
|
|
|
|
|
|
|
writer => 'set_to_string', |
|
85
|
|
|
|
|
|
|
predicate => 'has_to_string', |
|
86
|
|
|
|
|
|
|
clearer => 'clear_to_string', |
|
87
|
|
|
|
|
|
|
default => 0, |
|
88
|
|
|
|
|
|
|
); |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
#########1 Public Methods 3#########4#########5#########6#########7#########8#########9 |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub print_data{ |
|
94
|
|
|
|
|
|
|
### <where> - Made it to print |
|
95
|
|
|
|
|
|
|
##### <where> - Passed input : @_ |
|
96
|
13
|
|
|
13
|
1
|
38850
|
my $self = $_[0]; |
|
97
|
|
|
|
|
|
|
my $passed_ref = |
|
98
|
|
|
|
|
|
|
( @_ == 2 and |
|
99
|
|
|
|
|
|
|
( ( is_HashRef( $_[1] ) and |
|
100
|
13
|
50
|
33
|
|
|
101
|
!( exists $_[1]->{print_ref} ) ) or |
|
|
|
50
|
33
|
|
|
|
|
|
101
|
|
|
|
|
|
|
!is_HashRef( $_[1] ) ) ) ? |
|
102
|
|
|
|
|
|
|
{ print_ref => $_[1] } : |
|
103
|
|
|
|
|
|
|
( @_ == 2 and is_HashRef( $_[1] ) ) ? |
|
104
|
|
|
|
|
|
|
$_[1] : |
|
105
|
|
|
|
|
|
|
{ @_[1 .. $#_] } ; |
|
106
|
|
|
|
|
|
|
##### <where> - Passed hashref: $passed_ref |
|
107
|
13
|
|
|
|
|
32
|
@$passed_ref{ 'before_method', 'after_method' } = |
|
108
|
|
|
|
|
|
|
( '_print_before_method', '_print_after_method' ); |
|
109
|
|
|
|
|
|
|
##### <where> - Start recursive parsing with: $passed_ref |
|
110
|
13
|
|
|
|
|
42
|
$passed_ref = $self->_process_the_data( $passed_ref, $print_keys ); |
|
111
|
|
|
|
|
|
|
### <where> - End recursive parsing with: $passed_ref |
|
112
|
11
|
50
|
|
|
|
262
|
my $return = ( $self->get_to_string ) ? $self->_get_final_string : 1; |
|
113
|
11
|
|
|
|
|
283
|
$self->_clear_final_string; |
|
114
|
11
|
|
|
|
|
49
|
return $return; |
|
115
|
|
|
|
|
|
|
} |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
#########1 Private Attributes 3#########4#########5#########6#########7#########8#########9 |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
has '_pending_string' =>( |
|
120
|
|
|
|
|
|
|
is => 'ro', |
|
121
|
|
|
|
|
|
|
isa => Str, |
|
122
|
|
|
|
|
|
|
writer => '_set_pending_string', |
|
123
|
|
|
|
|
|
|
clearer => '_clear_pending_string', |
|
124
|
|
|
|
|
|
|
predicate => '_has_pending_string', |
|
125
|
|
|
|
|
|
|
reader => '_get_pending_string', |
|
126
|
|
|
|
|
|
|
); |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
has '_match_string' =>( |
|
129
|
|
|
|
|
|
|
is => 'ro', |
|
130
|
|
|
|
|
|
|
isa => Str, |
|
131
|
|
|
|
|
|
|
writer => '_set_match_string', |
|
132
|
|
|
|
|
|
|
clearer => '_clear_match_string', |
|
133
|
|
|
|
|
|
|
predicate => '_has_match_string', |
|
134
|
|
|
|
|
|
|
reader => '_get_match_string', |
|
135
|
|
|
|
|
|
|
); |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
has '_final_string' =>( |
|
138
|
|
|
|
|
|
|
is => 'ro', |
|
139
|
|
|
|
|
|
|
isa => Str, |
|
140
|
|
|
|
|
|
|
traits => ['String'], |
|
141
|
|
|
|
|
|
|
writer => '_set_final_string', |
|
142
|
|
|
|
|
|
|
clearer => '_clear_final_string', |
|
143
|
|
|
|
|
|
|
predicate => '_has_final_string', |
|
144
|
|
|
|
|
|
|
reader => '_get_final_string', |
|
145
|
|
|
|
|
|
|
handles => { |
|
146
|
|
|
|
|
|
|
_add_to_final_string => 'append', |
|
147
|
|
|
|
|
|
|
},, |
|
148
|
|
|
|
|
|
|
default => q{}, |
|
149
|
|
|
|
|
|
|
); |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
#########1 Private Methods 3#########4#########5#########6#########7#########8#########9 |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
sub _print_before_method{ |
|
154
|
95
|
|
|
95
|
|
62
|
my ( $self, $passed_ref ) = @_; |
|
155
|
|
|
|
|
|
|
### <where> - reached before_method ... |
|
156
|
|
|
|
|
|
|
#### <where> - received input: $passed_ref |
|
157
|
|
|
|
|
|
|
##### <where> - self: $self |
|
158
|
95
|
|
|
|
|
56
|
my ( $should_print ); |
|
159
|
95
|
100
|
66
|
|
|
2555
|
if( $self->get_match_highlighting and |
|
160
|
|
|
|
|
|
|
!$self->_has_match_string ){ |
|
161
|
37
|
|
|
|
|
950
|
$self->_set_match_string( '#<--- ' ); |
|
162
|
|
|
|
|
|
|
} |
|
163
|
|
|
|
|
|
|
### <where> - add before pre-string ... |
|
164
|
95
|
100
|
|
|
|
2658
|
if( $self->_get_current_level ){ |
|
165
|
|
|
|
|
|
|
### <where> - only available at level 1 + ... |
|
166
|
|
|
|
|
|
|
$self->_dispatch_method( |
|
167
|
|
|
|
|
|
|
$before_pre_string_dispatch, |
|
168
|
|
|
|
|
|
|
$passed_ref->{branch_ref}->[-1]->[0], |
|
169
|
|
|
|
|
|
|
$passed_ref, |
|
170
|
84
|
|
|
|
|
193
|
$passed_ref->{branch_ref}->[-1], |
|
171
|
|
|
|
|
|
|
); |
|
172
|
|
|
|
|
|
|
} |
|
173
|
|
|
|
|
|
|
### <where> - printing reference bracket ... |
|
174
|
95
|
100
|
|
|
|
136
|
if( $passed_ref->{skip} eq 'NO' ){ |
|
175
|
|
|
|
|
|
|
$should_print = $self->_dispatch_method( |
|
176
|
|
|
|
|
|
|
$before_method_dispatch, |
|
177
|
|
|
|
|
|
|
$passed_ref->{primary_type}, |
|
178
|
94
|
|
|
|
|
172
|
$passed_ref, |
|
179
|
|
|
|
|
|
|
); |
|
180
|
|
|
|
|
|
|
}else{ |
|
181
|
|
|
|
|
|
|
### <where> - Found a skip - handling it in the after_method ... |
|
182
|
|
|
|
|
|
|
} |
|
183
|
|
|
|
|
|
|
### <where> - print as needed ... |
|
184
|
95
|
100
|
|
|
|
131
|
if( $should_print ){ |
|
185
|
|
|
|
|
|
|
### <where> - found a line that should print ... |
|
186
|
52
|
|
|
|
|
57
|
$self->_print_pending_string; |
|
187
|
|
|
|
|
|
|
} |
|
188
|
|
|
|
|
|
|
### <where> - leaving before_method |
|
189
|
95
|
|
|
|
|
159
|
return $passed_ref; |
|
190
|
|
|
|
|
|
|
} |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
sub _print_after_method{ |
|
193
|
95
|
|
|
95
|
|
78
|
my ( $self, $passed_ref ) = @_; |
|
194
|
|
|
|
|
|
|
### <where> - reached the print after_method ... |
|
195
|
|
|
|
|
|
|
#### <where> - received input: $passed_ref |
|
196
|
|
|
|
|
|
|
##### <where> - self: $self |
|
197
|
|
|
|
|
|
|
my $should_print = $self->_dispatch_method( |
|
198
|
|
|
|
|
|
|
$after_method_dispatch, |
|
199
|
|
|
|
|
|
|
$passed_ref->{primary_type}, |
|
200
|
95
|
|
|
|
|
157
|
$passed_ref, |
|
201
|
|
|
|
|
|
|
); |
|
202
|
|
|
|
|
|
|
### <where> - Should Print: $should_print |
|
203
|
95
|
50
|
|
|
|
153
|
if( $should_print ){ |
|
204
|
|
|
|
|
|
|
### <where> - found a line that should print ... |
|
205
|
95
|
|
|
|
|
107
|
$self->_print_pending_string; |
|
206
|
|
|
|
|
|
|
} |
|
207
|
|
|
|
|
|
|
### <where> - after_method complete |
|
208
|
|
|
|
|
|
|
#### <where> - returning: $passed_ref |
|
209
|
95
|
|
|
|
|
164
|
return $passed_ref; |
|
210
|
|
|
|
|
|
|
} |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
sub _add_to_pending_string{ |
|
213
|
210
|
|
|
210
|
|
389
|
my ( $self, $string ) = @_; |
|
214
|
|
|
|
|
|
|
### <where> - reached _add_to_pending_string |
|
215
|
|
|
|
|
|
|
### <where> - adding: $string |
|
216
|
210
|
100
|
|
|
|
5448
|
$self->_set_pending_string( |
|
|
|
50
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
(($self->_has_pending_string) ? |
|
218
|
|
|
|
|
|
|
$self->_get_pending_string : '') . |
|
219
|
|
|
|
|
|
|
( ( $string ) ? $string : '' ) |
|
220
|
|
|
|
|
|
|
); |
|
221
|
210
|
|
|
|
|
220
|
return 1; |
|
222
|
|
|
|
|
|
|
} |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
sub _add_to_match_string{ |
|
225
|
175
|
|
|
175
|
|
158
|
my ( $self, $string ) = @_; |
|
226
|
|
|
|
|
|
|
### <where> - reached _add_to_match_string |
|
227
|
|
|
|
|
|
|
### <where> - adding: $string |
|
228
|
175
|
100
|
|
|
|
4488
|
$self->_set_match_string( |
|
|
|
50
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
(($self->_has_match_string) ? |
|
230
|
|
|
|
|
|
|
$self->_get_match_string : '') . |
|
231
|
|
|
|
|
|
|
( ( $string ) ? $string : '' ) |
|
232
|
|
|
|
|
|
|
); |
|
233
|
175
|
|
|
|
|
223
|
return 1; |
|
234
|
|
|
|
|
|
|
} |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
sub _print_pending_string{ |
|
237
|
147
|
|
|
147
|
|
138
|
my ( $self, $input ) = @_; |
|
238
|
|
|
|
|
|
|
### <where> - reached print pending string ... |
|
239
|
|
|
|
|
|
|
### <where> - called with additional input: $input |
|
240
|
|
|
|
|
|
|
#### <where> - match_highlighting called: $self->has_match_highlighting |
|
241
|
|
|
|
|
|
|
#### <where> - match_highlighting on: $self->get_match_highlighting |
|
242
|
|
|
|
|
|
|
#### <where> - secondary_ref exists: $self->_get_had_secondary |
|
243
|
|
|
|
|
|
|
#### <where> - has pending match string: $self->_has_match_string |
|
244
|
147
|
50
|
|
|
|
3618
|
if( $self->_has_pending_string ){ |
|
245
|
147
|
|
|
|
|
3849
|
my $new_string = $self->_add_tabs( $self->_get_current_level ); |
|
246
|
147
|
|
|
|
|
3615
|
$new_string .= $self->_get_pending_string; |
|
247
|
147
|
50
|
|
|
|
191
|
$new_string .= $input if $input; |
|
248
|
147
|
100
|
66
|
|
|
3790
|
if( $self->has_match_highlighting and |
|
|
|
|
66
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
249
|
|
|
|
|
|
|
$self->get_match_highlighting and |
|
250
|
|
|
|
|
|
|
$self->_get_had_secondary and |
|
251
|
|
|
|
|
|
|
$self->_has_match_string ){ |
|
252
|
|
|
|
|
|
|
### <where> - match_highlighting on - adding match string |
|
253
|
37
|
|
|
|
|
868
|
$new_string .= $self->_get_match_string; |
|
254
|
|
|
|
|
|
|
} |
|
255
|
147
|
|
|
|
|
136
|
$new_string .= "\n"; |
|
256
|
|
|
|
|
|
|
### <where> - printing string: $new_string |
|
257
|
147
|
50
|
|
|
|
3401
|
if( $self->get_to_string ){ |
|
258
|
0
|
|
|
|
|
0
|
$self->_add_to_final_string( $new_string ); |
|
259
|
|
|
|
|
|
|
}else{ |
|
260
|
147
|
|
|
|
|
1612
|
print $new_string; |
|
261
|
|
|
|
|
|
|
} |
|
262
|
|
|
|
|
|
|
} |
|
263
|
147
|
|
|
|
|
4083
|
$self->_clear_pending_string; |
|
264
|
147
|
|
|
|
|
3663
|
$self->_clear_match_string; |
|
265
|
147
|
|
|
|
|
191
|
return 1; |
|
266
|
|
|
|
|
|
|
} |
|
267
|
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
sub _before_hash_pre_string{ |
|
269
|
63
|
|
|
63
|
|
54
|
my ( $self, $passed_ref, $branch_ref ) = @_; |
|
270
|
|
|
|
|
|
|
### <where> - reached _before_hash_pre_string ... |
|
271
|
|
|
|
|
|
|
#### <where> - passed ref: $passed_ref |
|
272
|
63
|
|
|
|
|
120
|
$self->_add_to_pending_string( $branch_ref->[1] . ' => ' ); |
|
273
|
|
|
|
|
|
|
$self->_add_to_match_string( |
|
274
|
63
|
100
|
|
|
|
141
|
( $passed_ref->{secondary_type} ne 'DNE' ) ? |
|
275
|
|
|
|
|
|
|
'Hash Key Match - ' : 'Hash Key Mismatch - ' |
|
276
|
|
|
|
|
|
|
); |
|
277
|
|
|
|
|
|
|
### <where> - current pending string: $self->_get_pending_string |
|
278
|
|
|
|
|
|
|
### <where> - current match string: $self->_get_match_string |
|
279
|
|
|
|
|
|
|
} |
|
280
|
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
sub _before_array_pre_string{ |
|
282
|
21
|
|
|
21
|
|
19
|
my ( $self, $passed_ref, $branch_ref ) = @_; |
|
283
|
|
|
|
|
|
|
### <where> - reached _before_array_pre_string ... |
|
284
|
|
|
|
|
|
|
#### <where> - passed ref: $passed_ref |
|
285
|
|
|
|
|
|
|
$self->_add_to_match_string( |
|
286
|
21
|
100
|
|
|
|
48
|
( $passed_ref->{secondary_type} ne 'DNE' ) ? |
|
287
|
|
|
|
|
|
|
'Position Exists - ' : 'No Matching Position - ' |
|
288
|
|
|
|
|
|
|
); |
|
289
|
|
|
|
|
|
|
### <where> - current pending string: $self->_get_pending_string |
|
290
|
|
|
|
|
|
|
### <where> - current match string: $self->_get_match_string |
|
291
|
|
|
|
|
|
|
} |
|
292
|
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
sub _before_hash_printing{ |
|
294
|
42
|
|
|
42
|
|
45
|
my ( $self, $passed_ref ) = @_; |
|
295
|
|
|
|
|
|
|
### <where> - reached _before_hash_printing ... |
|
296
|
42
|
|
|
|
|
52
|
$self->_add_to_pending_string( '{' ); |
|
297
|
|
|
|
|
|
|
$self->_add_to_match_string( |
|
298
|
42
|
100
|
|
|
|
79
|
( $passed_ref->{secondary_type} eq 'HASH' ) ? |
|
299
|
|
|
|
|
|
|
'Ref Type Match' : 'Ref Type Mismatch' |
|
300
|
|
|
|
|
|
|
); |
|
301
|
|
|
|
|
|
|
### <where> - current pending string: $self->_get_pending_string |
|
302
|
|
|
|
|
|
|
### <where> - current match string: $self->_get_match_string |
|
303
|
42
|
|
|
|
|
64
|
return 1; |
|
304
|
|
|
|
|
|
|
} |
|
305
|
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
sub _before_array_printing{ |
|
307
|
10
|
|
|
10
|
|
12
|
my ( $self, $passed_ref ) = @_; |
|
308
|
|
|
|
|
|
|
### <where> - reached _before_array_printing ... |
|
309
|
|
|
|
|
|
|
#### <where> - passed ref: $passed_ref |
|
310
|
10
|
|
|
|
|
14
|
$self->_add_to_pending_string( '[' ); |
|
311
|
|
|
|
|
|
|
$self->_add_to_match_string( |
|
312
|
10
|
100
|
|
|
|
22
|
( $passed_ref->{secondary_type} eq 'ARRAY' ) ? |
|
313
|
|
|
|
|
|
|
'Ref Type Match' : 'Ref Type Mismatch' |
|
314
|
|
|
|
|
|
|
); |
|
315
|
|
|
|
|
|
|
### <where> - current pending string: $self->_get_pending_string |
|
316
|
|
|
|
|
|
|
### <where> - current match string: $self->_get_match_string |
|
317
|
10
|
|
|
|
|
17
|
return 1; |
|
318
|
|
|
|
|
|
|
} |
|
319
|
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
sub _before_object_printing{ |
|
321
|
0
|
|
|
0
|
|
0
|
my ( $self, $passed_ref ) = @_; |
|
322
|
|
|
|
|
|
|
### <where> - reached _before_object_printing ... |
|
323
|
|
|
|
|
|
|
#### <where> - passed ref: $passed_ref |
|
324
|
0
|
|
|
|
|
0
|
$self->_add_to_pending_string( 'BLESS : [' ); |
|
325
|
|
|
|
|
|
|
$self->_add_to_match_string( |
|
326
|
0
|
0
|
|
|
|
0
|
( $passed_ref->{secondary_type} eq 'ARRAY' ) ? |
|
327
|
|
|
|
|
|
|
'Ref Type Match' : 'Ref Type Mismatch' |
|
328
|
|
|
|
|
|
|
); |
|
329
|
|
|
|
|
|
|
### <where> - current pending string: $self->_get_pending_string |
|
330
|
|
|
|
|
|
|
### <where> - current match string: $self->_get_match_string |
|
331
|
0
|
|
|
|
|
0
|
return 1; |
|
332
|
|
|
|
|
|
|
} |
|
333
|
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
sub _after_scalar_printing{ |
|
335
|
39
|
|
|
39
|
|
40
|
my ( $self, $passed_ref, ) = @_; |
|
336
|
|
|
|
|
|
|
### <where> - reached _after_scalar_printing ... |
|
337
|
|
|
|
|
|
|
##### <where> - passed ref: $passed_ref |
|
338
|
|
|
|
|
|
|
$self->_add_to_pending_string( |
|
339
|
|
|
|
|
|
|
( |
|
340
|
|
|
|
|
|
|
( is_Num( $passed_ref->{primary_ref} ) ) ? |
|
341
|
|
|
|
|
|
|
$passed_ref->{primary_ref} : |
|
342
|
39
|
100
|
|
|
|
81
|
"'$passed_ref->{primary_ref}'" |
|
343
|
|
|
|
|
|
|
) . ',' |
|
344
|
|
|
|
|
|
|
); |
|
345
|
|
|
|
|
|
|
$self->_add_to_match_string( |
|
346
|
39
|
100
|
|
|
|
79
|
( $passed_ref->{match} eq 'YES' ) ? |
|
347
|
|
|
|
|
|
|
'Scalar Value Matches' : |
|
348
|
|
|
|
|
|
|
'Scalar Value Does NOT Match' |
|
349
|
|
|
|
|
|
|
); |
|
350
|
|
|
|
|
|
|
### <where> - current pending string: $self->_get_pending_string |
|
351
|
|
|
|
|
|
|
### <where> - current match string: $self->_get_match_string |
|
352
|
39
|
|
|
|
|
53
|
return 1; |
|
353
|
|
|
|
|
|
|
} |
|
354
|
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
sub _after_undef_printing{ |
|
356
|
3
|
|
|
3
|
|
3
|
my ( $self, $passed_ref, ) = @_; |
|
357
|
|
|
|
|
|
|
### <where> - reached _after_scalar_printing ... |
|
358
|
|
|
|
|
|
|
##### <where> - passed ref: $passed_ref |
|
359
|
3
|
|
|
|
|
7
|
$self->_add_to_pending_string( |
|
360
|
|
|
|
|
|
|
"undef," |
|
361
|
|
|
|
|
|
|
); |
|
362
|
|
|
|
|
|
|
### <where> - current pending string: $self->_get_pending_string |
|
363
|
3
|
|
|
|
|
3
|
return 1; |
|
364
|
|
|
|
|
|
|
} |
|
365
|
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
sub _after_array_printing{ |
|
367
|
11
|
|
|
11
|
|
12
|
my ( $self, $passed_ref ) = @_; |
|
368
|
|
|
|
|
|
|
### <where> - reached _after_array_printing ... |
|
369
|
|
|
|
|
|
|
##### <where> - passed ref: $passed_ref |
|
370
|
11
|
100
|
|
|
|
19
|
if( $passed_ref->{skip} eq 'YES' ){ |
|
371
|
1
|
|
|
|
|
4
|
$self->_add_to_pending_string( $passed_ref->{primary_ref} . ',' ); |
|
372
|
|
|
|
|
|
|
}else{ |
|
373
|
10
|
|
|
|
|
16
|
$self->_add_to_pending_string( '],' ); |
|
374
|
|
|
|
|
|
|
} |
|
375
|
|
|
|
|
|
|
### <where> - current pending string: $self->_get_pending_string |
|
376
|
11
|
|
|
|
|
14
|
return 1; |
|
377
|
|
|
|
|
|
|
} |
|
378
|
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
sub _after_hash_printing{ |
|
380
|
42
|
|
|
42
|
|
44
|
my ( $self, $passed_ref, $skip_method ) = @_; |
|
381
|
|
|
|
|
|
|
### <where> - reached _after_hash_printing ... |
|
382
|
|
|
|
|
|
|
##### <where> - passed ref: $passed_ref |
|
383
|
42
|
50
|
|
|
|
52
|
if( $passed_ref->{skip} eq 'YES' ){ |
|
384
|
0
|
|
|
|
|
0
|
$self->_add_to_pending_string( $passed_ref->{primary_ref} . ',' ); |
|
385
|
|
|
|
|
|
|
}else{ |
|
386
|
42
|
|
|
|
|
52
|
$self->_add_to_pending_string( '},' ); |
|
387
|
|
|
|
|
|
|
} |
|
388
|
|
|
|
|
|
|
### <where> - current pending string: $self->_get_pending_string |
|
389
|
42
|
|
|
|
|
57
|
return 1; |
|
390
|
|
|
|
|
|
|
} |
|
391
|
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
sub _after_object_printing{ |
|
393
|
0
|
|
|
0
|
|
0
|
my ( $self, $passed_ref, $skip_method ) = @_; |
|
394
|
|
|
|
|
|
|
### <where> - reached _after_object_printing ... |
|
395
|
|
|
|
|
|
|
##### <where> - passed ref: $passed_ref |
|
396
|
0
|
0
|
|
|
|
0
|
if( $passed_ref->{skip} eq 'YES' ){ |
|
397
|
0
|
|
|
|
|
0
|
$self->_add_to_pending_string( $passed_ref->{primary_ref} . ',' ); |
|
398
|
|
|
|
|
|
|
}else{ |
|
399
|
0
|
|
|
|
|
0
|
$self->_add_to_pending_string( '},' ); |
|
400
|
|
|
|
|
|
|
} |
|
401
|
|
|
|
|
|
|
### <where> - current pending string: $self->_get_pending_string |
|
402
|
0
|
|
|
|
|
0
|
return 1; |
|
403
|
|
|
|
|
|
|
} |
|
404
|
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
sub _add_tabs{ |
|
406
|
147
|
|
|
147
|
|
419
|
my ( $self, $current_level ) = @_; |
|
407
|
|
|
|
|
|
|
### <where> - reached _add_tabs ... |
|
408
|
|
|
|
|
|
|
##### <where> - current level: $current_level |
|
409
|
147
|
|
|
|
|
216
|
return ("\t" x $current_level); |
|
410
|
|
|
|
|
|
|
} |
|
411
|
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
#########1 Phinish Strong 3#########4#########5#########6#########7#########8#########9 |
|
413
|
|
|
|
|
|
|
|
|
414
|
2
|
|
|
2
|
|
5022
|
no Moose::Role; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
15
|
|
|
415
|
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
1; |
|
417
|
|
|
|
|
|
|
# The preceding line will help the module return a true value |
|
418
|
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
#########1 Main POD starts 3#########4#########5#########6#########7#########8#########9 |
|
420
|
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
__END__ |
|
422
|
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
=head1 NAME |
|
424
|
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
Data::Walk::Print - A data printing function |
|
426
|
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
428
|
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
#!perl |
|
430
|
|
|
|
|
|
|
use YAML::Any; |
|
431
|
|
|
|
|
|
|
use Moose::Util qw( with_traits ); |
|
432
|
|
|
|
|
|
|
use Data::Walk::Extracted; |
|
433
|
|
|
|
|
|
|
use Data::Walk::Print; |
|
434
|
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
#Use YAML to compress writing the data ref |
|
436
|
|
|
|
|
|
|
my $firstref = Load( |
|
437
|
|
|
|
|
|
|
'--- |
|
438
|
|
|
|
|
|
|
Someotherkey: |
|
439
|
|
|
|
|
|
|
value |
|
440
|
|
|
|
|
|
|
Parsing: |
|
441
|
|
|
|
|
|
|
HashRef: |
|
442
|
|
|
|
|
|
|
LOGGER: |
|
443
|
|
|
|
|
|
|
run: INFO |
|
444
|
|
|
|
|
|
|
Helping: |
|
445
|
|
|
|
|
|
|
- Somelevel |
|
446
|
|
|
|
|
|
|
- MyKey: |
|
447
|
|
|
|
|
|
|
MiddleKey: |
|
448
|
|
|
|
|
|
|
LowerKey1: lvalue1 |
|
449
|
|
|
|
|
|
|
LowerKey2: |
|
450
|
|
|
|
|
|
|
BottomKey1: 12345 |
|
451
|
|
|
|
|
|
|
BottomKey2: |
|
452
|
|
|
|
|
|
|
- bavalue1 |
|
453
|
|
|
|
|
|
|
- bavalue2 |
|
454
|
|
|
|
|
|
|
- bavalue3' |
|
455
|
|
|
|
|
|
|
); |
|
456
|
|
|
|
|
|
|
my $secondref = Load( |
|
457
|
|
|
|
|
|
|
'--- |
|
458
|
|
|
|
|
|
|
Someotherkey: |
|
459
|
|
|
|
|
|
|
value |
|
460
|
|
|
|
|
|
|
Helping: |
|
461
|
|
|
|
|
|
|
- Somelevel |
|
462
|
|
|
|
|
|
|
- MyKey: |
|
463
|
|
|
|
|
|
|
MiddleKey: |
|
464
|
|
|
|
|
|
|
LowerKey1: lvalue1 |
|
465
|
|
|
|
|
|
|
LowerKey2: |
|
466
|
|
|
|
|
|
|
BottomKey2: |
|
467
|
|
|
|
|
|
|
- bavalue1 |
|
468
|
|
|
|
|
|
|
- bavalue3 |
|
469
|
|
|
|
|
|
|
BottomKey1: 12354' |
|
470
|
|
|
|
|
|
|
); |
|
471
|
|
|
|
|
|
|
my $AT_ST = with_traits( |
|
472
|
|
|
|
|
|
|
'Data::Walk::Extracted', |
|
473
|
|
|
|
|
|
|
( 'Data::Walk::Print' ), |
|
474
|
|
|
|
|
|
|
)->new( |
|
475
|
|
|
|
|
|
|
match_highlighting => 1,#This is the default |
|
476
|
|
|
|
|
|
|
); |
|
477
|
|
|
|
|
|
|
$AT_ST->print_data( |
|
478
|
|
|
|
|
|
|
print_ref => $firstref, |
|
479
|
|
|
|
|
|
|
match_ref => $secondref, |
|
480
|
|
|
|
|
|
|
sorted_nodes =>{ |
|
481
|
|
|
|
|
|
|
HASH => 1, #To force order for demo purposes |
|
482
|
|
|
|
|
|
|
} |
|
483
|
|
|
|
|
|
|
); |
|
484
|
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
################################################################################# |
|
486
|
|
|
|
|
|
|
# Output of SYNOPSIS |
|
487
|
|
|
|
|
|
|
# 01:{#<--- Ref Type Match |
|
488
|
|
|
|
|
|
|
# 02: Helping => [#<--- Secondary Key Match - Ref Type Match |
|
489
|
|
|
|
|
|
|
# 03: 'Somelevel',#<--- Secondary Position Exists - Secondary Value Matches |
|
490
|
|
|
|
|
|
|
# 04: {#<--- Secondary Position Exists - Ref Type Match |
|
491
|
|
|
|
|
|
|
# 05: MyKey => {#<--- Secondary Key Match - Ref Type Match |
|
492
|
|
|
|
|
|
|
# 06: MiddleKey => {#<--- Secondary Key Match - Ref Type Match |
|
493
|
|
|
|
|
|
|
# 07: LowerKey1 => 'lvalue1',#<--- Secondary Key Match - Secondary Value Matches |
|
494
|
|
|
|
|
|
|
# 08: LowerKey2 => {#<--- Secondary Key Match - Ref Type Match |
|
495
|
|
|
|
|
|
|
# 09: BottomKey1 => '12345',#<--- Secondary Key Match - Secondary Value Does NOT Match |
|
496
|
|
|
|
|
|
|
# 10: BottomKey2 => [#<--- Secondary Key Match - Ref Type Match |
|
497
|
|
|
|
|
|
|
# 11: 'bavalue1',#<--- Secondary Position Exists - Secondary Value Matches |
|
498
|
|
|
|
|
|
|
# 12: 'bavalue2',#<--- Secondary Position Exists - Secondary Value Does NOT Match |
|
499
|
|
|
|
|
|
|
# 13: 'bavalue3',#<--- Secondary Position Does NOT Exist - Secondary Value Does NOT Match |
|
500
|
|
|
|
|
|
|
# 14: ], |
|
501
|
|
|
|
|
|
|
# 15: }, |
|
502
|
|
|
|
|
|
|
# 16: }, |
|
503
|
|
|
|
|
|
|
# 17: }, |
|
504
|
|
|
|
|
|
|
# 18: }, |
|
505
|
|
|
|
|
|
|
# 19: ], |
|
506
|
|
|
|
|
|
|
# 20: Parsing => {#<--- Secondary Key Mismatch - Ref Type Mismatch |
|
507
|
|
|
|
|
|
|
# 21: HashRef => {#<--- Secondary Key Mismatch - Ref Type Mismatch |
|
508
|
|
|
|
|
|
|
# 22: LOGGER => {#<--- Secondary Key Mismatch - Ref Type Mismatch |
|
509
|
|
|
|
|
|
|
# 23: run => 'INFO',#<--- Secondary Key Mismatch - Secondary Value Does NOT Match |
|
510
|
|
|
|
|
|
|
# 24: }, |
|
511
|
|
|
|
|
|
|
# 25: }, |
|
512
|
|
|
|
|
|
|
# 26: }, |
|
513
|
|
|
|
|
|
|
# 27: Someotherkey => 'value',#<--- Secondary Key Match - Secondary Value Matches |
|
514
|
|
|
|
|
|
|
# 28:}, |
|
515
|
|
|
|
|
|
|
################################################################################# |
|
516
|
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
519
|
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
This L<Moose::Role|https://metacpan.org/module/Moose::Manual::Roles> is mostly written |
|
521
|
|
|
|
|
|
|
as a demonstration module for |
|
522
|
|
|
|
|
|
|
L<Data::Walk::Extracted|https://metacpan.org/module/Data::Walk::Extracted>. |
|
523
|
|
|
|
|
|
|
Both L<Data::Dumper|https://metacpan.org/module/Data::Dumper#Functions> - Dumper and |
|
524
|
|
|
|
|
|
|
L<YAML|https://metacpan.org/module/YAML::Any#SUBROUTINES> - Dump functions are more mature than |
|
525
|
|
|
|
|
|
|
the printing function included here. |
|
526
|
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
=head2 USE |
|
528
|
|
|
|
|
|
|
|
|
529
|
|
|
|
|
|
|
This is a L<Moose::Role|https://metacpan.org/module/Moose::Manual::Roles> specifically |
|
530
|
|
|
|
|
|
|
designed to be used with L<Data::Walk::Extracted |
|
531
|
|
|
|
|
|
|
|https://metacpan.org/module/Data::Walk::Extracted#Extending-Data::Walk::Extracted>. |
|
532
|
|
|
|
|
|
|
It can be combined traditionaly to the ~::Extracted class using L<Moose |
|
533
|
|
|
|
|
|
|
|https://metacpan.org/module/Moose::Manual::Roles> methods or for information on how to join |
|
534
|
|
|
|
|
|
|
this role to Data::Walk::Extracted at run time see L<Moose::Util |
|
535
|
|
|
|
|
|
|
|https://metacpan.org/module/Moose::Util> or L<MooseX::ShortCut::BuildInstance |
|
536
|
|
|
|
|
|
|
|https://metacpan.org/module/MooseX::ShortCut::BuildInstance> for more information. |
|
537
|
|
|
|
|
|
|
|
|
538
|
|
|
|
|
|
|
=head1 Attributes |
|
539
|
|
|
|
|
|
|
|
|
540
|
|
|
|
|
|
|
Data passed to -E<gt>new when creating an instance. For modification of these attributes |
|
541
|
|
|
|
|
|
|
see L<Methods|/Methods>. The -E<gt>new function will either accept fat comma lists or a |
|
542
|
|
|
|
|
|
|
complete hash ref that has the possible attributes as the top keys. Additionally |
|
543
|
|
|
|
|
|
|
some attributes that have all the following methods; get_$attribute, set_$attribute, |
|
544
|
|
|
|
|
|
|
has_$attribute, and clear_$attribute, can be passed to L<print_data |
|
545
|
|
|
|
|
|
|
|/print_data( $arg_ref|%args|$data_ref )> and will be adjusted for just the run of that |
|
546
|
|
|
|
|
|
|
method call. These are called 'one shot' attributes. The class and each role (where |
|
547
|
|
|
|
|
|
|
applicable) in this package have a list of L<supported one shot attributes |
|
548
|
|
|
|
|
|
|
|/Supported one shot attributes>. |
|
549
|
|
|
|
|
|
|
|
|
550
|
|
|
|
|
|
|
=head2 match_highlighting |
|
551
|
|
|
|
|
|
|
|
|
552
|
|
|
|
|
|
|
=over |
|
553
|
|
|
|
|
|
|
|
|
554
|
|
|
|
|
|
|
B<Definition:> this determines if a comments string is added after each printed |
|
555
|
|
|
|
|
|
|
row that indicates how the 'print_ref' matches the 'match_ref'. |
|
556
|
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
B<Default> True (1) |
|
558
|
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
B<Range> This is a Boolean data type and generally accepts 1 or 0 |
|
560
|
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
=back |
|
562
|
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
=head2 to_string |
|
564
|
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
=over |
|
566
|
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
B<Definition:> this determines whether the output is sent to STDOUT or coallated |
|
568
|
|
|
|
|
|
|
into a final string and sent as a result of L<print_data |
|
569
|
|
|
|
|
|
|
|/print_data( $arg_ref|%args|$data_ref )>. |
|
570
|
|
|
|
|
|
|
|
|
571
|
|
|
|
|
|
|
B<Default> True (1) |
|
572
|
|
|
|
|
|
|
|
|
573
|
|
|
|
|
|
|
B<Range> This is a Boolean data type and generally accepts 1 or 0 |
|
574
|
|
|
|
|
|
|
|
|
575
|
|
|
|
|
|
|
=back |
|
576
|
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
=head2 (see also) |
|
578
|
|
|
|
|
|
|
|
|
579
|
|
|
|
|
|
|
L<Data::Walk::Extracted|https://metacpan.org/module/Data::Walk::Extracted#Attributes> |
|
580
|
|
|
|
|
|
|
- Attributes |
|
581
|
|
|
|
|
|
|
|
|
582
|
|
|
|
|
|
|
=head1 Methods |
|
583
|
|
|
|
|
|
|
|
|
584
|
|
|
|
|
|
|
=head2 print_data( $arg_ref|%args|$data_ref ) |
|
585
|
|
|
|
|
|
|
|
|
586
|
|
|
|
|
|
|
=over |
|
587
|
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
B<Definition:> this is the method used to print a data reference |
|
589
|
|
|
|
|
|
|
|
|
590
|
|
|
|
|
|
|
B<Accepts:> either a single data reference or named arguments |
|
591
|
|
|
|
|
|
|
in a fat comma list or hashref |
|
592
|
|
|
|
|
|
|
|
|
593
|
|
|
|
|
|
|
=over |
|
594
|
|
|
|
|
|
|
|
|
595
|
|
|
|
|
|
|
B<named variable option> - if data comes in a fat comma list or as a hash ref |
|
596
|
|
|
|
|
|
|
and the keys include a 'print_ref' key then the list is processed as follows. |
|
597
|
|
|
|
|
|
|
|
|
598
|
|
|
|
|
|
|
=over |
|
599
|
|
|
|
|
|
|
|
|
600
|
|
|
|
|
|
|
B<print_ref> - this is the data reference that should be printed in a perlish way |
|
601
|
|
|
|
|
|
|
- Required |
|
602
|
|
|
|
|
|
|
|
|
603
|
|
|
|
|
|
|
B<match_ref> - this is a reference used to compare against the 'print_ref' |
|
604
|
|
|
|
|
|
|
- Optional |
|
605
|
|
|
|
|
|
|
|
|
606
|
|
|
|
|
|
|
B<[attribute name]> - attribute names are accepted with temporary attribute settings. |
|
607
|
|
|
|
|
|
|
These settings are temporarily set for a single "print_data" call and then the original |
|
608
|
|
|
|
|
|
|
attribute values are restored. For this to work the the attribute must meet the |
|
609
|
|
|
|
|
|
|
L<necessary criteria|/Attributes>. These attributes can include all attributes active |
|
610
|
|
|
|
|
|
|
for the constructed class not just this role. |
|
611
|
|
|
|
|
|
|
|
|
612
|
|
|
|
|
|
|
=back |
|
613
|
|
|
|
|
|
|
|
|
614
|
|
|
|
|
|
|
B<single variable option> - if only one data_ref is sent and it fails the test |
|
615
|
|
|
|
|
|
|
for "exists $data_ref->{print_ref}" then the program will attempt to name it as |
|
616
|
|
|
|
|
|
|
print_ref => $data_ref and then process the data as a fat comma list. |
|
617
|
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
=back |
|
619
|
|
|
|
|
|
|
|
|
620
|
|
|
|
|
|
|
B<Returns:> 1 (And prints out the data ref) or a string - see L<to_string|/to_string> |
|
621
|
|
|
|
|
|
|
|
|
622
|
|
|
|
|
|
|
=back |
|
623
|
|
|
|
|
|
|
|
|
624
|
|
|
|
|
|
|
=head2 set_match_highlighting( $bool ) |
|
625
|
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
=over |
|
627
|
|
|
|
|
|
|
|
|
628
|
|
|
|
|
|
|
B<Definition:> this is a way to change the L<match_highlighting|/match_highlighting> |
|
629
|
|
|
|
|
|
|
attribute |
|
630
|
|
|
|
|
|
|
|
|
631
|
|
|
|
|
|
|
B<Accepts:> a Boolean value |
|
632
|
|
|
|
|
|
|
|
|
633
|
|
|
|
|
|
|
B<Returns:> '' |
|
634
|
|
|
|
|
|
|
|
|
635
|
|
|
|
|
|
|
=back |
|
636
|
|
|
|
|
|
|
|
|
637
|
|
|
|
|
|
|
=head2 get_match_highlighting |
|
638
|
|
|
|
|
|
|
|
|
639
|
|
|
|
|
|
|
=over |
|
640
|
|
|
|
|
|
|
|
|
641
|
|
|
|
|
|
|
B<Definition:> this is a way to view the state of the L<match_highlighting|/match_highlighting> |
|
642
|
|
|
|
|
|
|
attribute |
|
643
|
|
|
|
|
|
|
|
|
644
|
|
|
|
|
|
|
B<Accepts:> nothing |
|
645
|
|
|
|
|
|
|
|
|
646
|
|
|
|
|
|
|
B<Returns:> The current 'match_highlighting' state |
|
647
|
|
|
|
|
|
|
|
|
648
|
|
|
|
|
|
|
=back |
|
649
|
|
|
|
|
|
|
|
|
650
|
|
|
|
|
|
|
=head2 has_match_highlighting |
|
651
|
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
=over |
|
653
|
|
|
|
|
|
|
|
|
654
|
|
|
|
|
|
|
B<Definition:> this is a way to know if the L<match_highlighting|/match_highlighting> |
|
655
|
|
|
|
|
|
|
attribute is active |
|
656
|
|
|
|
|
|
|
|
|
657
|
|
|
|
|
|
|
B<Accepts:> nothing |
|
658
|
|
|
|
|
|
|
|
|
659
|
|
|
|
|
|
|
B<Returns:> 1 if the attribute is active (not just if it == 1) |
|
660
|
|
|
|
|
|
|
|
|
661
|
|
|
|
|
|
|
=back |
|
662
|
|
|
|
|
|
|
|
|
663
|
|
|
|
|
|
|
=head2 clear_match_highlighting |
|
664
|
|
|
|
|
|
|
|
|
665
|
|
|
|
|
|
|
=over |
|
666
|
|
|
|
|
|
|
|
|
667
|
|
|
|
|
|
|
B<Definition:> this clears the L<match_highlighting|/match_highlighting> attribute |
|
668
|
|
|
|
|
|
|
|
|
669
|
|
|
|
|
|
|
B<Accepts:> nothing |
|
670
|
|
|
|
|
|
|
|
|
671
|
|
|
|
|
|
|
B<Returns:> '' (always successful) |
|
672
|
|
|
|
|
|
|
|
|
673
|
|
|
|
|
|
|
=back |
|
674
|
|
|
|
|
|
|
|
|
675
|
|
|
|
|
|
|
=head2 set_to_string( $bool ) |
|
676
|
|
|
|
|
|
|
|
|
677
|
|
|
|
|
|
|
=over |
|
678
|
|
|
|
|
|
|
|
|
679
|
|
|
|
|
|
|
B<Definition:> this is a way to change the L<to_string|/to_string> |
|
680
|
|
|
|
|
|
|
attribute |
|
681
|
|
|
|
|
|
|
|
|
682
|
|
|
|
|
|
|
B<Accepts:> a Boolean value |
|
683
|
|
|
|
|
|
|
|
|
684
|
|
|
|
|
|
|
B<Returns:> '' |
|
685
|
|
|
|
|
|
|
|
|
686
|
|
|
|
|
|
|
=back |
|
687
|
|
|
|
|
|
|
|
|
688
|
|
|
|
|
|
|
=head2 get_to_string |
|
689
|
|
|
|
|
|
|
|
|
690
|
|
|
|
|
|
|
=over |
|
691
|
|
|
|
|
|
|
|
|
692
|
|
|
|
|
|
|
B<Definition:> this is a way to view the state of the L<to_string|/to_string> |
|
693
|
|
|
|
|
|
|
attribute |
|
694
|
|
|
|
|
|
|
|
|
695
|
|
|
|
|
|
|
B<Accepts:> nothing |
|
696
|
|
|
|
|
|
|
|
|
697
|
|
|
|
|
|
|
B<Returns:> The current 'to_string' state |
|
698
|
|
|
|
|
|
|
|
|
699
|
|
|
|
|
|
|
=back |
|
700
|
|
|
|
|
|
|
|
|
701
|
|
|
|
|
|
|
=head2 has_to_string |
|
702
|
|
|
|
|
|
|
|
|
703
|
|
|
|
|
|
|
=over |
|
704
|
|
|
|
|
|
|
|
|
705
|
|
|
|
|
|
|
B<Definition:> this is a way to know if the L<to_string|/to_string> |
|
706
|
|
|
|
|
|
|
attribute is active |
|
707
|
|
|
|
|
|
|
|
|
708
|
|
|
|
|
|
|
B<Accepts:> nothing |
|
709
|
|
|
|
|
|
|
|
|
710
|
|
|
|
|
|
|
B<Returns:> 1 if the attribute is active (not just if it == 1) |
|
711
|
|
|
|
|
|
|
|
|
712
|
|
|
|
|
|
|
=back |
|
713
|
|
|
|
|
|
|
|
|
714
|
|
|
|
|
|
|
=head2 clear_to_string |
|
715
|
|
|
|
|
|
|
|
|
716
|
|
|
|
|
|
|
=over |
|
717
|
|
|
|
|
|
|
|
|
718
|
|
|
|
|
|
|
B<Definition:> this clears the L<to_string|/to_string> attribute |
|
719
|
|
|
|
|
|
|
|
|
720
|
|
|
|
|
|
|
B<Accepts:> nothing |
|
721
|
|
|
|
|
|
|
|
|
722
|
|
|
|
|
|
|
B<Returns:> '' (always successful) |
|
723
|
|
|
|
|
|
|
|
|
724
|
|
|
|
|
|
|
=back |
|
725
|
|
|
|
|
|
|
|
|
726
|
|
|
|
|
|
|
=head1 Caveat utilitor |
|
727
|
|
|
|
|
|
|
|
|
728
|
|
|
|
|
|
|
=head2 Supported Node types |
|
729
|
|
|
|
|
|
|
|
|
730
|
|
|
|
|
|
|
=over |
|
731
|
|
|
|
|
|
|
|
|
732
|
|
|
|
|
|
|
=item ARRAY |
|
733
|
|
|
|
|
|
|
|
|
734
|
|
|
|
|
|
|
=item HASH |
|
735
|
|
|
|
|
|
|
|
|
736
|
|
|
|
|
|
|
=item SCALAR |
|
737
|
|
|
|
|
|
|
|
|
738
|
|
|
|
|
|
|
=item UNDEF |
|
739
|
|
|
|
|
|
|
|
|
740
|
|
|
|
|
|
|
=back |
|
741
|
|
|
|
|
|
|
|
|
742
|
|
|
|
|
|
|
=head2 Supported one shot attributes |
|
743
|
|
|
|
|
|
|
|
|
744
|
|
|
|
|
|
|
L<explanation|/Attributes> |
|
745
|
|
|
|
|
|
|
|
|
746
|
|
|
|
|
|
|
=over |
|
747
|
|
|
|
|
|
|
|
|
748
|
|
|
|
|
|
|
=item match_highlighting |
|
749
|
|
|
|
|
|
|
|
|
750
|
|
|
|
|
|
|
=item to_string |
|
751
|
|
|
|
|
|
|
|
|
752
|
|
|
|
|
|
|
=back |
|
753
|
|
|
|
|
|
|
|
|
754
|
|
|
|
|
|
|
=head2 Printing for skipped nodes |
|
755
|
|
|
|
|
|
|
|
|
756
|
|
|
|
|
|
|
L<Data::Walk::Extracted|https://metacpan.org/module/Data::Walk::Extracted> allows for some |
|
757
|
|
|
|
|
|
|
nodes to be skipped. When a node is skipped the L<print_data |
|
758
|
|
|
|
|
|
|
|/print_data( $arg_ref|%args|$data_ref )> function prints the scalar (perl pointer description) |
|
759
|
|
|
|
|
|
|
of that node. |
|
760
|
|
|
|
|
|
|
|
|
761
|
|
|
|
|
|
|
=head1 GLOBAL VARIABLES |
|
762
|
|
|
|
|
|
|
|
|
763
|
|
|
|
|
|
|
=over |
|
764
|
|
|
|
|
|
|
|
|
765
|
|
|
|
|
|
|
B<$ENV{Smart_Comments}> |
|
766
|
|
|
|
|
|
|
|
|
767
|
|
|
|
|
|
|
The module uses L<Smart::Comments|https://metacpan.org/module/Smart::Comments> if the '-ENV' |
|
768
|
|
|
|
|
|
|
option is set. The 'use' is encapsulated in an if block triggered by an environmental |
|
769
|
|
|
|
|
|
|
variable to comfort non-believers. Setting the variable $ENV{Smart_Comments} in a BEGIN |
|
770
|
|
|
|
|
|
|
block will load and turn on smart comment reporting. There are three levels of 'Smartness' |
|
771
|
|
|
|
|
|
|
available in this module '###', '####', and '#####'. |
|
772
|
|
|
|
|
|
|
|
|
773
|
|
|
|
|
|
|
=back |
|
774
|
|
|
|
|
|
|
|
|
775
|
|
|
|
|
|
|
=head1 SUPPORT |
|
776
|
|
|
|
|
|
|
|
|
777
|
|
|
|
|
|
|
=over |
|
778
|
|
|
|
|
|
|
|
|
779
|
|
|
|
|
|
|
L<github Data-Walk-Extracted/issues|https://github.com/jandrew/Data-Walk-Extracted/issues> |
|
780
|
|
|
|
|
|
|
|
|
781
|
|
|
|
|
|
|
=back |
|
782
|
|
|
|
|
|
|
|
|
783
|
|
|
|
|
|
|
=head1 TODO |
|
784
|
|
|
|
|
|
|
|
|
785
|
|
|
|
|
|
|
=over |
|
786
|
|
|
|
|
|
|
|
|
787
|
|
|
|
|
|
|
B<1.> Convert from L<Smart::Comments|https://metacpan.org/module/Smart::Comments> debugging |
|
788
|
|
|
|
|
|
|
to L<Log::Shiras|https://metacpan.org/module/Log::Shiras> debugging messages. |
|
789
|
|
|
|
|
|
|
|
|
790
|
|
|
|
|
|
|
B<2.> Support printing Objects / Instances |
|
791
|
|
|
|
|
|
|
|
|
792
|
|
|
|
|
|
|
B<3.> Support printing CodeRefs |
|
793
|
|
|
|
|
|
|
|
|
794
|
|
|
|
|
|
|
B<4.> Support REF types |
|
795
|
|
|
|
|
|
|
|
|
796
|
|
|
|
|
|
|
=back |
|
797
|
|
|
|
|
|
|
|
|
798
|
|
|
|
|
|
|
=head1 AUTHOR |
|
799
|
|
|
|
|
|
|
|
|
800
|
|
|
|
|
|
|
=over |
|
801
|
|
|
|
|
|
|
|
|
802
|
|
|
|
|
|
|
=item Jed Lund |
|
803
|
|
|
|
|
|
|
|
|
804
|
|
|
|
|
|
|
=item jandrew@cpan.org |
|
805
|
|
|
|
|
|
|
|
|
806
|
|
|
|
|
|
|
=back |
|
807
|
|
|
|
|
|
|
|
|
808
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
809
|
|
|
|
|
|
|
|
|
810
|
|
|
|
|
|
|
This program is free software; you can redistribute |
|
811
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
|
812
|
|
|
|
|
|
|
|
|
813
|
|
|
|
|
|
|
The full text of the license can be found in the |
|
814
|
|
|
|
|
|
|
LICENSE file included with this module. |
|
815
|
|
|
|
|
|
|
|
|
816
|
|
|
|
|
|
|
This software is copyrighted (c) 2013 by Jed Lund. |
|
817
|
|
|
|
|
|
|
|
|
818
|
|
|
|
|
|
|
=head1 Dependencies |
|
819
|
|
|
|
|
|
|
|
|
820
|
|
|
|
|
|
|
L<version|https://metacpan.org/module/version> |
|
821
|
|
|
|
|
|
|
|
|
822
|
|
|
|
|
|
|
L<Moose::Role|https://metacpan.org/module/Moose::Role> |
|
823
|
|
|
|
|
|
|
|
|
824
|
|
|
|
|
|
|
=over |
|
825
|
|
|
|
|
|
|
|
|
826
|
|
|
|
|
|
|
B<requires> |
|
827
|
|
|
|
|
|
|
|
|
828
|
|
|
|
|
|
|
=over |
|
829
|
|
|
|
|
|
|
|
|
830
|
|
|
|
|
|
|
=item _process_the_data |
|
831
|
|
|
|
|
|
|
|
|
832
|
|
|
|
|
|
|
=item _get_had_secondary |
|
833
|
|
|
|
|
|
|
|
|
834
|
|
|
|
|
|
|
=item _dispatch_method |
|
835
|
|
|
|
|
|
|
|
|
836
|
|
|
|
|
|
|
=back |
|
837
|
|
|
|
|
|
|
|
|
838
|
|
|
|
|
|
|
=back |
|
839
|
|
|
|
|
|
|
|
|
840
|
|
|
|
|
|
|
L<MooseX::Types::Moose|https://metacpan.org/module/MooseX::Types::Moose> |
|
841
|
|
|
|
|
|
|
|
|
842
|
|
|
|
|
|
|
L<Data::Walk::Extracted|https://metacpan.org/module/Data::Walk::Extracted> |
|
843
|
|
|
|
|
|
|
|
|
844
|
|
|
|
|
|
|
L<Data::Walk::Extracted::Dispatch|https://metacpan.org/module/Data::Walk::Extracted::Dispatch> |
|
845
|
|
|
|
|
|
|
|
|
846
|
|
|
|
|
|
|
|
|
847
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
848
|
|
|
|
|
|
|
|
|
849
|
|
|
|
|
|
|
=over |
|
850
|
|
|
|
|
|
|
|
|
851
|
|
|
|
|
|
|
L<Smart::Comments|https://metacpan.org/module/Smart::Comments> - is used if the -ENV option is set |
|
852
|
|
|
|
|
|
|
|
|
853
|
|
|
|
|
|
|
L<Data::Walk|https://metacpan.org/module/Data::Walk> |
|
854
|
|
|
|
|
|
|
|
|
855
|
|
|
|
|
|
|
L<Data::Walker|https://metacpan.org/module/Data::Walker> |
|
856
|
|
|
|
|
|
|
|
|
857
|
|
|
|
|
|
|
L<Data::Dumper|https://metacpan.org/module/Data::Dumper> - Dumper |
|
858
|
|
|
|
|
|
|
|
|
859
|
|
|
|
|
|
|
L<YAML|https://metacpan.org/module/YAML> - Dump |
|
860
|
|
|
|
|
|
|
|
|
861
|
|
|
|
|
|
|
L<Data::Walk::Prune|https://metacpan.org/module/Data::Walk::Prune> - available Data::Walk::Extracted Role |
|
862
|
|
|
|
|
|
|
|
|
863
|
|
|
|
|
|
|
L<Data::Walk::Graft|https://metacpan.org/module/Data::Walk::Graft> - available Data::Walk::Extracted Role |
|
864
|
|
|
|
|
|
|
|
|
865
|
|
|
|
|
|
|
L<Data::Walk::Clone|https://metacpan.org/module/Data::Walk::Clone> - available Data::Walk::Extracted Role |
|
866
|
|
|
|
|
|
|
|
|
867
|
|
|
|
|
|
|
=back |
|
868
|
|
|
|
|
|
|
|
|
869
|
|
|
|
|
|
|
=cut |
|
870
|
|
|
|
|
|
|
|
|
871
|
|
|
|
|
|
|
#########1 Main POD ends 3#########4#########5#########6#########7#########8#########9 |