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