Path/Evaluator.pm

filter: Statementstmt 89.0% 364 / 409 Branchbran 75.9% 167 / 220 Conditioncond 52.3% 33 / 63 MC/DCmcdc 32.3% 11 / 34 Subroutinesub 95.0% 38 / 40 Podpod 100% 3 / 3 totaltotal 80.1% 616 / 769 CC 152 SCAR 30.1
CC
152
Cov
82%
_get_token
136.2
_compare
26.2
_evaluate
20.1
CRAP 20.3
↑ Summary Path/Tokenizer.pm »
1 package JSON::Path::Evaluator;
2 17 $JSON::Path::Evaluator::VERSION = '0.51';
3 17 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 17 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 17 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 # ABSTRACT: A module that recursively evaluates JSONPath expressions with native support for Javascript-style filters
8  
9 17 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 17 ▶use Carp::Assert qw(assert);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 17 ▶use JSON::MaybeXS;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 17 ▶use JSON::Path::Constants qw(:operators :symbols);
Subroutine BEGIN: called CC=1 SCAR=0.0
13 17 ▶use JSON::Path::Tokenizer qw(tokenize);
Subroutine BEGIN: called CC=1 SCAR=0.0
14 17 ▶use List::Util qw/pairs uniq/;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 17 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 17 ▶use Safe;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 17 ▶use Scalar::Util qw/looks_like_number blessed refaddr/;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 17 ▶use Storable qw/dclone/;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 17 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 # VERSION
22 17 ▶use Exporter::Shiny qw/evaluate_jsonpath/;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 17 our $AUTHORITY = 'cpan:POPEFELIX';
24  
25 17 Readonly my $OPERATOR_IS_TRUE => 'IS_TRUE';
26 17 Readonly my $OPERATOR_TYPE_PATH => 1;
27 17 Readonly my $OPERATOR_TYPE_COMPARISON => 2;
28 17 Readonly my %OPERATORS => (
29 $TOKEN_ROOT => $OPERATOR_TYPE_PATH, # $
30 $TOKEN_CURRENT => $OPERATOR_TYPE_PATH, # @
31 $TOKEN_CHILD => $OPERATOR_TYPE_PATH, # . OR []
32 $TOKEN_RECURSIVE => $OPERATOR_TYPE_PATH, # ..
33 $TOKEN_ALL => $OPERATOR_TYPE_PATH, # *
34 $TOKEN_FILTER_OPEN => $OPERATOR_TYPE_PATH, # ?(
35 $TOKEN_SCRIPT_OPEN => $OPERATOR_TYPE_PATH, # (
36 $TOKEN_FILTER_SCRIPT_CLOSE => $OPERATOR_TYPE_PATH, # )
37 $TOKEN_SUBSCRIPT_OPEN => $OPERATOR_TYPE_PATH, # [
38 $TOKEN_SUBSCRIPT_CLOSE => $OPERATOR_TYPE_PATH, # ]
39 $TOKEN_UNION => $OPERATOR_TYPE_PATH, # ,
40 $TOKEN_ARRAY_SLICE => $OPERATOR_TYPE_PATH, # [ start:end:step ]
41 $TOKEN_SINGLE_EQUAL => $OPERATOR_TYPE_COMPARISON, # =
42 $TOKEN_DOUBLE_EQUAL => $OPERATOR_TYPE_COMPARISON, # ==
43 $TOKEN_TRIPLE_EQUAL => $OPERATOR_TYPE_COMPARISON, # ===
44 $TOKEN_GREATER_THAN => $OPERATOR_TYPE_COMPARISON, # >
45 $TOKEN_LESS_THAN => $OPERATOR_TYPE_COMPARISON, # <
46 $TOKEN_NOT_EQUAL => $OPERATOR_TYPE_COMPARISON, # !=
47 $TOKEN_GREATER_EQUAL => $OPERATOR_TYPE_COMPARISON, # >=
48 $TOKEN_LESS_EQUAL => $OPERATOR_TYPE_COMPARISON, # <=
49 );
50  
51 17 Readonly my $ASSERT_ENABLE => $ENV{ASSERT_ENABLE};
52  
53  
54 sub new {
55 114 ▶ my $class = shift;
Subroutine new: called CC=9 SCAR=22.5
Pod documented
56 114 ▶ my %args = ref $_[0] eq 'HASH' ? %{ $_[0] } : @_;
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] eq 'HASH' ? : 0 114 114
57 114 my $self = {};
58 114 for my $key (qw/root expression/) {
59 228 ▶ croak qq{Missing required argument '$key' in constructor} unless $args{$key};
Branch: 1 branch
BranchTrueFalseTotal
unless $args{$key} 0 228 228
60 228 $self->{$key} = $args{$key};
61 }
62 114 ▶ $self->{want_ref} = $args{want_ref} || 0;
Condition50%1/2
$args{'want_ref'} || 0
l!l
0114
MC/DC0%0/1
$args{'want_ref'} || 0
$args{'want_ref'}
Truth table50%1/2
A
A= $args{'want_ref'}
Aresult
11
00
63 114 ▶ $self->{_calling_context} = $args{_calling_context} || 0;
Condition50%1/2
$args{'_calling_context'} || 0
l!l
1140
MC/DC0%0/1
$args{'_calling_context'} || 0
$args{'_calling_context'}
Truth table50%1/2
A
A= $args{'_calling_context'}
Aresult
11
00
64  
65 my $script_engine =
66 114 ▶ $args{script_engine} ? $args{script_engine} : $self->{expression} =~ /\$_/ ? 'perl' : undef;
Branch: 2 branches
BranchTrueFalseTotal
$args{'script_engine'} ? : 26 88 114
$self->{'expression'} =~ /\$_/ ? : 5 83 88
67 114 ▶ $self->{script_engine} = $script_engine || 'PseudoJS';
Condition100%2/2
$script_engine || 'PseudoJS'
l!l
3183
MC/DC100%1/1
$script_engine || 'PseudoJS'
$script_engine
Truth table100%2/2
A
A= $script_engine
Aresult
11
00
68 114 bless $self, $class;
69 114 return $self;
70 }
71  
72  
73 sub evaluate_jsonpath {
74 114 ▶ my ( $json_object, $expression, %args ) = @_;
Subroutine evaluate_jsonpath: called CC=5 SCAR=16.1
Pod documented
75  
76 114 ▶ if ( !ref $json_object ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $json_object) 57 57 114
77 try {
78 57 ▶ $json_object = decode_json($json_object);
Subroutine __ANON__: called CC=1 SCAR=0.0
79 }
80 catch {
81 0 ▶ croak qq{Unable to decode $json_object as JSON: $_};
Subroutine __ANON__: not called CC=1 SCAR=6.9
82 }
83 57 }
84  
85 114 ▶ my $want_ref = delete $args{want_ref} || 0;
Condition100%2/2
delete $args{'want_ref'} || 0
l!l
3282
MC/DC100%1/1
delete $args{'want_ref'} || 0
delete $args{'want_ref'}
Truth table100%2/2
A
A= delete $args{'want_ref'}
Aresult
11
00
86 114 ▶ my $want_path = delete $args{want_path} || 0;
Condition100%2/2
delete $args{'want_path'} || 0
l!l
11103
MC/DC100%1/1
delete $args{'want_path'} || 0
delete $args{'want_path'}
Truth table100%2/2
A
A= delete $args{'want_path'}
Aresult
11
00
87  
88 114 ▶ my $self = __PACKAGE__->new(
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 112 2 114
89 root => $json_object,
90 expression => $expression,
91 _calling_context => wantarray ? 'ARRAY' : 'SCALAR',
92 %args
93 );
94 114 return $self->evaluate( $expression, want_ref => $want_ref, want_path => $want_path );
95 }
96  
97  
98 sub evaluate {
99 114 ▶ my ( $self, $expression, %args ) = @_;
Subroutine evaluate: called CC=6 SCAR=17.9
Pod documented
100  
101 114 my $json_object = $self->{root};
102  
103 114 my $token_stream = [ tokenize($expression) ];
104 114 ▶ shift @{$token_stream} if $token_stream->[0] eq $TOKEN_ROOT;
Branch: 1 branch
BranchTrueFalseTotal
if $token_stream->[0] eq $JSON::Path::Evaluator::TOKEN_ROOT 114 0 114
105 114 ▶ shift @{$token_stream} if $token_stream->[0] eq $TOKEN_CHILD;
Branch: 1 branch
BranchTrueFalseTotal
if $token_stream->[0] eq $JSON::Path::Evaluator::TOKEN_CHILD 95 19 114
106  
107 114 ▶ if ( $args{want_path} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args{"want_path"}) 11 103 114
108 11 my %reftable = $self->_reftable_walker($json_object);
109 11 my @refs = $self->_evaluate( $json_object, dclone $token_stream, 1 );
110  
111 11 my @paths;
112 11 for my $ref (@refs) {
113 17 ▶ my $refaddr = ref ${$ref} ? refaddr ${$ref} : refaddr $ref;
Branch: 1 branch
BranchTrueFalseTotal
ref ${$ref;} ? : 9 8 17
114 17 push @paths, $reftable{$refaddr};
115 }
116 11 return @paths;
117 }
118  
119 103 my @ret = $self->_evaluate( $json_object, $token_stream, $args{want_ref} );
120 103 return @ret;
121 }
122  
123 sub _reftable_walker {
124 77 ▶ my ( $self, $json_object, $base_path ) = @_;
Subroutine _reftable_walker: called CC=9 SCAR=22.1
125  
126 77 ▶ $base_path = defined $base_path ? $base_path : '$';
Branch: 1 branch
BranchTrueFalseTotal
defined $base_path ? : 66 11 77
127 77 ▶ $json_object = defined $json_object ? $json_object : $self->root;
Branch: 1 branch
BranchTrueFalseTotal
defined $json_object ? : 77 0 77
128  
129 77 my @entries = ( refaddr $json_object => $base_path );
130  
131 77 ▶ if ( _arraylike($json_object) ) {
Branch: 2 branches
BranchTrueFalseTotal
if (_arraylike($json_object)) { } 8 69 77
elsif (_hashlike($json_object)) { } 63 6 69
132 8 for ( 0 .. $#{$json_object} ) {
133 30 my $path = sprintf q{%s['%d']}, $base_path, $_;
134 30 ▶ if ( ref $json_object->[$_] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $json_object->[$_]) { } 30 0 30
135 30 push @entries, $self->_reftable_walker( $json_object->[$_], $path );
136 }
137 else {
138 0 push @entries, refaddr \( $json_object->[$_] ) => $path;
139 }
140 }
141 }
142 elsif ( _hashlike($json_object) ) {
143 63 for my $index ( keys %{$json_object} ) {
144 234 my $path = sprintf q{%s['%s']}, $base_path, $index;
145 234 ▶ if ( ref $json_object->{$index} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $json_object->{$index}) { } 36 198 234
146 36 push @entries, $self->_reftable_walker( $json_object->{$index}, $path );
147 }
148 else {
149 198 push @entries, refaddr \( $json_object->{$index} ) => $path;
150 }
151 }
152 }
153 77 return @entries;
154 }
155  
156 sub _evaluate { # This assumes that the token stream is syntactically valid
157 576 ▶ my ( $self, $obj, $token_stream, $want_ref ) = @_;
Subroutine _evaluate: called CC=20 SCAR=30.0
158  
159 576 ▶ return unless ref $obj;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $obj 84 492 576
160  
161 492 ▶ $token_stream = defined $token_stream ? $token_stream : [];
Branch: 1 branch
BranchTrueFalseTotal
defined $token_stream ? : 492 0 492
162  
163 492 ▶ while ( defined( my $token = shift @{$token_stream} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $token = shift @{$token_stream;})) 928 0 928
164 928 ▶ next if $token eq $TOKEN_CURRENT;
Branch: 1 branch
BranchTrueFalseTotal
if $token eq $JSON::Path::Evaluator::TOKEN_CURRENT 147 781 928
165 781 ▶ next if $token eq $TOKEN_CHILD;
Branch: 1 branch
BranchTrueFalseTotal
if $token eq $JSON::Path::Evaluator::TOKEN_CHILD 289 492 781
166  
167 492 ▶ if ( $token eq $TOKEN_FILTER_OPEN ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($token eq $JSON::Path::Evaluator::TOKEN_FILTER_OPEN) { } 30 462 492
elsif ($token eq $JSON::Path::Evaluator::TOKEN_RECURSIVE) { } 16 446 462
168 30 my $filter_expression = shift @{$token_stream};
169  
170 30 my $closing_token = shift @{$token_stream};
171 30 ▶ assert( $closing_token eq $TOKEN_FILTER_SCRIPT_CLOSE, q{Closing token seen} ) if $ASSERT_ENABLE;
Branch: 1 branch
BranchTrueFalseTotal
if $ASSERT_ENABLE 0 30 30
172  
173 # Find all indices matching the filter expression. This modifies $token_stream
174 30 my @matching_indices = $self->_process_filter( $obj, $filter_expression );
175  
176 30 ▶ if ( !@{$token_stream} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not @{$token_stream;}) { } 11 19 30
177 11 my @got = map { _get( $obj, $_ ) } @matching_indices;
178 11 ▶ return $want_ref ? @got : map { ${$_} } @got;
Branch: 1 branch
BranchTrueFalseTotal
$want_ref ? : 6 5 11
179 }
180 else {
181 19 return map { $self->_evaluate( _get( $obj, $_ ), dclone($token_stream), $want_ref ) } @matching_indices;
182 }
183 }
184 elsif ( $token eq $TOKEN_RECURSIVE )
185 { # Sweet Jesus, Pooh, that's not honey! You're eating Sweet Jesus, Pooh, that's not honey! You're eating...
186 16 my $index = shift @{$token_stream};
187 16 my @matched;
188 16 ▶ if ( $index eq $TOKEN_FILTER_OPEN ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index eq $JSON::Path::Evaluator::TOKEN_FILTER_OPEN) 2 14 16
189 2 my $filter_expression = shift @{$token_stream};
190  
191 2 my $closing_token = shift @{$token_stream};
192 2 ▶ assert( $closing_token eq $TOKEN_FILTER_SCRIPT_CLOSE, q{Closing token seen} ) if $ASSERT_ENABLE;
Branch: 1 branch
BranchTrueFalseTotal
if $ASSERT_ENABLE 0 2 2
193  
194 2 return $self->_filter_recursive( $obj, $filter_expression, $want_ref );
195 }
196  
197 14 @matched = _match_recursive( $obj, $index, $want_ref );
198 14 ▶ if ( !@{$token_stream} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@{$token_stream;}) 6 8 14
199 6 return @matched;
200 }
201 8 return map { $self->_evaluate( $_, dclone($token_stream), $want_ref ) } @matched;
202 }
203 else {
204 446 my $index;
205 446 ▶ if ( $token eq $TOKEN_SUBSCRIPT_OPEN ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($token eq $JSON::Path::Evaluator::TOKEN_SUBSCRIPT_OPEN) { } 63 383 446
206 63 $index = shift @{$token_stream};
207 63 my $closing_token = shift @{$token_stream};
208 63 ▶ assert $closing_token eq $TOKEN_SUBSCRIPT_CLOSE if $ASSERT_ENABLE;
Branch: 1 branch
BranchTrueFalseTotal
if $ASSERT_ENABLE 0 63 63
209 }
210 else {
211 383 $index = $token;
212 }
213  
214 446 ▶ assert( !$OPERATORS{$index}, qq{"$index" is not an operator} ) if $index ne $TOKEN_ALL;
Branch: 1 branch
BranchTrueFalseTotal
if $index ne $JSON::Path::Evaluator::TOKEN_ALL 431 15 446
215 446 ▶ assert( !ref $index, q{Index is a scalar} ) if $ASSERT_ENABLE;
Branch: 1 branch
BranchTrueFalseTotal
if $ASSERT_ENABLE 0 446 446
216  
217 446 my (@got) = _get( $obj, $index, create_key => $want_ref ); # This always returns a ref
218 446 ▶ if ( !@{$token_stream} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not @{$token_stream;}) { } 280 166 446
219 280 ▶ return $want_ref ? @got : map { ${$_} } @got;
Branch: 1 branch
BranchTrueFalseTotal
$want_ref ? : 44 236 280
220 }
221 else {
222 166 return map { $self->_evaluate( ${$_}, dclone($token_stream), $want_ref ) } @got;
223 }
224 }
225 }
226 }
227  
228 sub _process_filter {
229 70 ▶ my ( $self, $obj, $filter_expression ) = @_;
Subroutine _process_filter: called CC=3 SCAR=11.2
230  
231 70 my @matching_indices;
232 70 ▶ if ( $self->{script_engine} eq 'PseudoJS' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->{'script_engine'} eq 'PseudoJS') { } 64 6 70
elsif ($self->{'script_engine'} eq 'perl') { } 6 0 6
233 64 @matching_indices = $self->_process_pseudo_js( $obj, $filter_expression );
234 }
235 elsif ( $self->{script_engine} eq 'perl' ) {
236 6 @matching_indices = $self->_process_perl( $obj, $filter_expression );
237 }
238 else {
239 0 croak qq{Unsupported script engine "$self->{script_engine}"};
240 }
241 70 return @matching_indices;
242 }
243  
244 # This _always_ has to return a ref so that when it's called from evaluate( ... , want_ref => 1)
245 # So that we can return a ref into the object (e.g. for use as an lvalue), even when the path points
246 # to a scalar (which will of course be copied).
247 #
248 # I.E.: for { foo => 'bar' }, we always want \( foo->{bar} ) so that
249 # JSON::Path->new('$.foo')->value($obj) = 'baz' works like it oughtta.
250 sub _get {
251 610 ▶ my ( $object, $index, %args ) = @_;
Subroutine _get: called CC=16 SCAR=27.9
252  
253 610 ▶ assert( _hashlike($object) || _arraylike($object), 'Object is a hashref or an arrayref' ) if $ASSERT_ENABLE;
Branch: 1 branch
BranchTrueFalseTotal
if $ASSERT_ENABLE 0 610 610
Condition0%0/3
_hashlike($object) || _arraylike($object)
l!l&&r!l&&!r
000
MC/DC0%0/2
_hashlike($object) || _arraylike($object)
_hashlike($object) _arraylike($object)
Truth table0%0/3
A || B
A= _hashlike($object)B= _arraylike($object)
ABresult
1X1
011
000
254  
255 610 my $create_key = $args{create_key};
256  
257 # When want_ref is passed to _evaluate(), it will return a reference to whatever was matched.
258 # If what was matched is itself a ref (e.g. an arrayref), _evaluate() will return a ref of
259 # type 'REF'.
260 610 ▶ if ( ref $object eq 'REF' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $object eq "REF") 23 587 610
261 23 $object = ${$object};
262 }
263  
264 610 ▶ if ( $index eq $TOKEN_ALL ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index eq $JSON::Path::Evaluator::TOKEN_ALL) { } 15 595 610
265 15 ▶ if ( _hashlike($object) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (_hashlike($object)) { } 1 14 15
266 1 return map { \($_) } values %{$object};
267 }
268 else {
269 14 return map { \($_) } @{$object};
270 }
271 }
272 else {
273 595 my @indices;
274 595 ▶ if ( $index =~ /$TOKEN_ARRAY_SLICE/ ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($index =~ /$JSON::Path::Evaluator::TOKEN_ARRAY_SLICE/) { } 9 586 595
elsif ($index =~ /$JSON::Path::Evaluator::TOKEN_UNION/) { } 5 581 586
275 9 ▶ my $length = _hashlike($object) ? scalar values %{$object} : scalar @{$object};
Branch: 1 branch
BranchTrueFalseTotal
_hashlike($object) ? : 0 9 9
276 9 @indices = _slice( $index, $length );
277 }
278 elsif ( $index =~ /$TOKEN_UNION/ ) {
279 5 @indices = split /$TOKEN_UNION/, $index;
280 }
281 else {
282 581 @indices = ($index);
283 }
284  
285 595 ▶ if ( _hashlike($object) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (_hashlike($object)) { } 463 132 595
286 463 ▶ if ($create_key) {
Branch: 1 branch
BranchTrueFalseTotal
if ($create_key) { } 84 379 463
287 84 return map { \( $object->{$_} ) } @indices;
288 }
289 else {
290 379 my @ret;
291 379 for my $index (@indices) {
292 380 ▶ push @ret, \( $object->{$index} ) if exists $object->{$index};
Branch: 1 branch
BranchTrueFalseTotal
if exists $object->{$index} 357 23 380
293 }
294 379 return @ret;
295 }
296 }
297 else {
298 132 my @numeric_indices = grep { looks_like_number($_) } @indices;
299 132 ▶ if ($create_key) {
Branch: 1 branch
BranchTrueFalseTotal
if ($create_key) { } 18 114 132
300 18 return map { \( $object->[$_] ) } @numeric_indices;
301 }
302 else {
303 114 my @ret;
304 114 for my $index (@numeric_indices) {
305 105 ▶ push @ret, \( $object->[$index] ) if exists $object->[$index];
Branch: 1 branch
BranchTrueFalseTotal
if exists $object->[$index] 105 0 105
306 }
307 114 return @ret;
308 }
309 }
310 }
311 }
312  
313 sub _indices {
314 40 ▶ my $object = shift;
Subroutine _indices: called CC=3 SCAR=11.0
315 return
316 27 ▶ _hashlike($object) ? keys %{$object}
Branch: 1 branch
BranchTrueFalseTotal
_arraylike($object) ? : 11 2 13
317 40 ▶ : _arraylike($object) ? ( 0 .. $#{$object} )
Branch: 1 branch
BranchTrueFalseTotal
_hashlike($object) ? : 27 13 40
318 : ();
319 }
320  
321 sub _hashlike {
322 1023 ▶ my $object = shift;
Subroutine _hashlike: called CC=4 SCAR=15.6
323 1023 ▶ return ( ref $object eq 'HASH' || ( blessed $object && $object->can('typeof') && $object->typeof eq 'HASH' ) );
Condition55%5/9
ref $object eq 'HASH' || builtin::blessed($object) && $object->can('typeof') && $object->typeof eq 'HASH'
l!l&&r!l&&!r
7740249
builtin::blessed($object) and $object->can("typeof") and $object->typeof eq "HASH"
!ll&&!rl&&r
24900
builtin::blessed($object) and $object->can("typeof")
!ll&&!rl&&r
229200
MC/DC25%1/4
ref $object eq 'HASH' || builtin::blessed($object) && $object->can('typeof') && $object->typeof eq 'HASH'
ref $object eq 'HASH' builtin::blessed($object) $object->can("typeof") $object->typeof eq "HASH"
Truth table60%3/5
A || B and C and D
A= ref $object eq 'HASH'B= builtin::blessed($object)C= $object->can("typeof")D= $object->typeof eq "HASH"
ABCDresult
1XXX1
01111
00XX0
010X0
01100
324 }
325  
326 sub _arraylike {
327 434 ▶ my $object = shift;
Subroutine _arraylike: called CC=4 SCAR=15.6
328 434 ▶ return ( ref $object eq 'ARRAY' || ( blessed $object && $object->can('typeof') && $object->typeof eq 'ARRAY' ) );
Condition55%5/9
ref $object eq 'ARRAY' || builtin::blessed($object) && $object->can('typeof') && $object->typeof eq 'ARRAY'
l!l&&r!l&&!r
1620272
builtin::blessed($object) and $object->can("typeof") and $object->typeof eq "ARRAY"
!ll&&!rl&&r
27200
builtin::blessed($object) and $object->can("typeof")
!ll&&!rl&&r
254180
MC/DC25%1/4
ref $object eq 'ARRAY' || builtin::blessed($object) && $object->can('typeof') && $object->typeof eq 'ARRAY'
ref $object eq 'ARRAY' builtin::blessed($object) $object->can("typeof") $object->typeof eq "ARRAY"
Truth table60%3/5
A || B and C and D
A= ref $object eq 'ARRAY'B= builtin::blessed($object)C= $object->can("typeof")D= $object->typeof eq "ARRAY"
ABCDresult
1XXX1
01111
00XX0
010X0
01100
329 }
330  
331 sub _get_token {
332 0 ▶ my $token_stream = shift;
Subroutine _get_token: not called CC=13 SCAR=49.1
333 0 my $token = shift @{$token_stream};
334 0 ▶ return unless defined $token;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $token 0 0 0
335  
336 0 ▶ if ( $token eq $TOKEN_SUBSCRIPT_OPEN ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($token eq $JSON::Path::Evaluator::TOKEN_SUBSCRIPT_OPEN) 0 0 0
337 0 my @substream;
338 my $close_seen;
339 0 ▶ while ( defined( my $token = shift @{$token_stream} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $token = shift @{$token_stream;})) 0 0 0
340 0 ▶ if ( $token eq $TOKEN_SUBSCRIPT_CLOSE ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($token eq $JSON::Path::Evaluator::TOKEN_SUBSCRIPT_CLOSE) 0 0 0
341 0 $close_seen = 1;
342 0 last;
343 }
344 0 push @substream, $token;
345 }
346  
347 0 ▶ assert($close_seen) if $ASSERT_ENABLE;
Branch: 1 branch
BranchTrueFalseTotal
if $ASSERT_ENABLE 0 0 0
348  
349 0 ▶ if ( grep { $_ eq $TOKEN_ARRAY_SLICE } @substream ) {
Branch: 2 branches
BranchTrueFalseTotal
if (grep {$_ eq $JSON::Path::Evaluator::TOKEN_ARRAY_SLICE;} @substream) { } 0 0 0
elsif (grep {$_ eq $JSON::Path::Evaluator::TOKEN_UNION;} @substream) { } 0 0 0
350  
351 # There are five valid cases:
352 #
353 # n:m -> n:m:1
354 # n:m:s -> n:m:s
355 # :m -> 0:m:1
356 # ::s -> 0:-1:s
357 # n: -> n:-1:1
358 0 ▶ if ( $substream[0] eq $TOKEN_ARRAY_SLICE ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($substream[0] eq $JSON::Path::Evaluator::TOKEN_ARRAY_SLICE) 0 0 0
359 0 unshift @substream, undef;
360 }
361  
362 17 ▶ no warnings qw/uninitialized/;
Subroutine BEGIN: called CC=1 SCAR=0.0
363 0 ▶ if ( $substream[2] eq $TOKEN_ARRAY_SLICE ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($substream[2] eq $JSON::Path::Evaluator::TOKEN_ARRAY_SLICE) 0 0 0
364 0 @substream = ( @substream[ ( 0, 1 ) ], undef, @substream[ ( 2 .. $#substream ) ] );
365 }
366 17 ▶ use warnings qw/uninitialized/;
Subroutine BEGIN: called CC=1 SCAR=0.0
367  
368 0 my ( $start, $end, $step );
369 0 ▶ $start = $substream[0] // 0;
Condition0%0/2
$substream[0] // 0
l!l
00
MC/DC0%0/1
$substream[0] // 0
$substream[0]
Truth table0%0/2
A
A= $substream[0]
Aresult
11
00
370 0 ▶ $end = $substream[2] // -1;
Condition0%0/2
$substream[2] // -1
l!l
00
MC/DC0%0/1
$substream[2] // -1
$substream[2]
Truth table0%0/2
A
A= $substream[2]
Aresult
11
00
371 0 ▶ $step = $substream[4] // 1;
Condition0%0/2
$substream[4] // 1
l!l
00
MC/DC0%0/1
$substream[4] // 1
$substream[4]
Truth table0%0/2
A
A= $substream[4]
Aresult
11
00
372 0 return { slice => [ $start, $end, $step ] };
373 }
374 0 elsif ( grep { $_ eq $TOKEN_UNION } @substream ) {
375 0 my @union = grep { $_ ne $TOKEN_UNION } @substream;
376 0 return { union => \@union };
377 }
378  
379 0 return $substream[0];
380 }
381 0 return $token;
382 }
383  
384 # See http://wiki.ecmascript.org/doku.php?id=proposals:slice_syntax
385 #
386 # in particular, for the slice [n:m], m is *one greater* than the last index to slice.
387 # This means that the slice [3:5] will return indices 3 and 4, but *not* 5.
388 sub _slice {
389 9 ▶ my ( $index, $length ) = @_;
Subroutine _slice: called CC=10 SCAR=25.2
390  
391 9 my ( $start, $end, $step ) = split /$TOKEN_ARRAY_SLICE/, $index, 3;
392  
393 9 ▶ if ( !defined($start) || $start eq '' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $start or $start eq "") 0 9 9
Condition33%1/3
not defined $start or $start eq ""
l!l&&r!l&&!r
009
MC/DC0%0/2
not defined $start or $start eq ""
not defined $start $start eq ""
Truth table33%1/3
not(A) or B
A= not defined $startB= $start eq ""
ABresult
1X1
011
000
394 0 $start = 0;
395 }
396 9 ▶ if ( !defined($end) || $end eq '' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $end or $end eq "") 6 3 9
Condition66%2/3
not defined $end or $end eq ""
l!l&&r!l&&!r
063
MC/DC50%1/2
not defined $end or $end eq ""
not defined $end $end eq ""
Truth table66%2/3
not(A) or B
A= not defined $endB= $end eq ""
ABresult
1X1
011
000
397 6 $end = -1;
398 }
399 9 ▶ if ( !defined($step) || $step eq '' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $step or $step eq "") 9 0 9
Condition33%1/3
not defined $step or $step eq ""
l!l&&r!l&&!r
900
MC/DC0%0/2
not defined $step or $step eq ""
not defined $step $step eq ""
Truth table33%1/3
not(A) or B
A= not defined $stepB= $step eq ""
ABresult
1X1
011
000
400 9 $step = 1;
401 }
402  
403 9 ▶ $start = ( $length - 1 ) if $start == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $start == -1 6 3 9
404 9 ▶ $end = $length if $end == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $end == -1 6 3 9
405  
406 9 my @indices;
407 9 ▶ if ( $step < 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($step < 0) { } 0 9 9
408 0 @indices = grep { %_ % -$step == 0 } reverse( $start .. ( $end - 1 ) );
409 }
410 else {
411 9 @indices = grep { $_ % $step == 0 } ( $start .. ( $end - 1 ) );
412 }
413 9 return @indices;
414 }
415  
416 sub _match_recursive {
417 281 ▶ my ( $obj, $index, $want_ref ) = @_;
Subroutine _match_recursive: called CC=13 SCAR=26.1
418  
419 281 my @match;
420  
421 # Fix for RT #122529.
422 #
423 # Consider the expression "$..foo..bar", evaluated with respect to the JSON "{"foo":{"bar":"baz"}}".
424 #
425 # The first term to be evaluated in the expression is "$..foo". If want_ref is passed to evaluate(),
426 # this will return a REF reference. In that case we must first dereference it to get the object that
427 # we will evaluate "..bar" with respect to.
428 281 ▶ if ( ref $obj eq 'REF' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $obj eq "REF") 2 279 281
429 2 $obj = ${$obj};
430 }
431  
432 281 ▶ if ( _arraylike($obj) ) {
Branch: 2 branches
BranchTrueFalseTotal
if (_arraylike($obj)) { } 82 199 281
elsif (_hashlike($obj)) { } 191 8 199
433 82 ▶ if ( looks_like_number($index) && exists $obj->[$index] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&looks_like_number($index) and exists $obj->[$index]) 0 82 82
Condition33%1/3
&looks_like_number($index) and exists $obj->[$index]
!ll&&!rl&&r
8200
MC/DC0%0/2
&looks_like_number($index) and exists $obj->[$index]
&looks_like_number($index) exists $obj->[$index]
Truth table33%1/3
A and B
A= &looks_like_number($index)B= exists $obj->[$index]
ABresult
0X0
100
111
434 0 ▶ push @match, $want_ref ? \( $obj->[$index] ) : $obj->[$index];
Branch: 1 branch
BranchTrueFalseTotal
$want_ref ? : 0 0 0
435 }
436 82 for ( 0 .. $#{$obj} ) {
437 251 ▶ next unless ref $obj->[$_];
Branch: 1 branch
BranchTrueFalseTotal
unless ref $obj->[$_] 136 115 251
438 115 push @match, _match_recursive( $obj->[$_], $index, $want_ref );
439 }
440 }
441 elsif ( _hashlike($obj) ) {
442 191 ▶ if ( exists $obj->{$index} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $obj->{$index}) 16 175 191
443 16 ▶ push @match, $want_ref ? \( $obj->{$index} ) : $obj->{$index};
Branch: 1 branch
BranchTrueFalseTotal
$want_ref ? : 8 8 16
444 }
445 191 for my $val ( values %{$obj} ) {
446 591 ▶ next unless ref $val;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $val 439 152 591
447 152 push @match, _match_recursive( $val, $index, $want_ref );
448 }
449 }
450 281 return @match;
451 }
452  
453 sub _filter_recursive {
454 40 ▶ my ( $self, $obj, $expression, $want_ref ) = @_;
Subroutine _filter_recursive: called CC=5 SCAR=16.1
455  
456 40 my @ret;
457  
458 # Evaluate the filter expression for the current object
459 40 my @matching_indices = $self->_process_filter( $obj, $expression );
460 40 for my $index (@matching_indices) {
461 4 my ($got) = _get( $obj, $index );
462 4 ▶ push @ret, $want_ref ? $got : ${$got};
Branch: 1 branch
BranchTrueFalseTotal
$want_ref ? : 2 2 4
463 }
464  
465 # Evaluate the filter expression for any subordinate objects
466 40 for my $index ( _indices($obj) ) {
467 122 my ($got) = _get( $obj, $index );
468 122 $got = ${$got}; # _get will always return a reference. We want the value, so dereference it
469 122 ▶ next unless ref $got;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $got 84 38 122
470 38 push @ret, $self->_filter_recursive( $got, $expression, $want_ref );
471 }
472  
473 40 return @ret;
474 }
475  
476 sub _process_pseudo_js {
477 64 ▶ my ( $self, $object, $expressions ) = @_;
Subroutine _process_pseudo_js: called CC=10 SCAR=23.0
478  
479 64 my @expressions_or = split /\Q||\E/, $expressions;
480 64 my @matching_or;
481  
482 64 foreach my $expression (@expressions_or) {
483 74 my @expressions_and = split /\Q&&\E/, $expression;
484 74 my %matching_and;
485  
486 74 foreach my $expression (@expressions_and) {
487  
488 90 my ( $lhs, $operator, $rhs ) = _parse_psuedojs_expression($expression);
489  
490 90 my (@token_stream) = tokenize($lhs);
491  
492 90 my @lhs;
493 90 ▶ if ( _hashlike($object) ) {
Branch: 2 branches
BranchTrueFalseTotal
if (_hashlike($object)) { } 27 63 90
elsif (_arraylike($object)) { } 61 2 63
494 27 @lhs = map { $self->_evaluate( $_, [@token_stream] ) } values %{$object};
495 }
496 elsif ( _arraylike($object) ) {
497 61 for my $value ( @{$object} ) {
498 143 my ($got) = $self->_evaluate( $value, [@token_stream] );
499 143 push @lhs, $got;
500 }
501 }
502  
503 # get indexes that pass compare()
504 90 for ( 0 .. $#lhs ) {
505 143 my $val = $lhs[$_];
506 143 ▶ $matching_and{$_}++ if _compare( $operator, $val, $rhs );
Branch: 1 branch
BranchTrueFalseTotal
if _compare($operator, $val, $rhs) 61 82 143
507 }
508 }
509 74 ▶ while (my ($idx, $val) = each(%matching_and)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %matching_and) 49 74 123
510 49 ▶ push @matching_or, $idx if ($val == @expressions_and);
Branch: 1 branch
BranchTrueFalseTotal
if $val == @expressions_and 34 15 49
511 }
512 }
513  
514 64 return sort(uniq(@matching_or));
515 }
516  
517 sub _parse_psuedojs_expression {
518 90 ▶ my $expression = shift;
Subroutine _parse_psuedojs_expression: called CC=12 SCAR=25.1
519 90 my @parts;
520  
521 90 my ( $lhs, $operator, $rhs );
522  
523 # The operator could be '=', '!=', '==', '===', '<=', or '>='
524 90 ▶ if ( $expression =~ /$EQUAL_SIGN/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expression =~ /$JSON::Path::Evaluator::EQUAL_SIGN/) { } 23 67 90
525 23 my $position = index( $expression, '=' );
526 23 ▶ if ( substr( $expression, $position + 1, 1 ) eq $EQUAL_SIGN ) { # could be '==' or '==='
Branch: 1 branch
BranchTrueFalseTotal
if (substr($expression, $position + 1, 1) eq $JSON::Path::Evaluator::EQUAL_SIGN) { } 12 11 23
527 12 ▶ if ( substr( $expression, $position + 2, 1 ) eq $EQUAL_SIGN ) { # ===
Branch: 1 branch
BranchTrueFalseTotal
if (substr($expression, $position + 2, 1) eq $JSON::Path::Evaluator::EQUAL_SIGN) { } 0 12 12
528 0 $operator = $TOKEN_TRIPLE_EQUAL;
529 }
530 else {
531 12 $operator = $TOKEN_DOUBLE_EQUAL;
532 }
533 }
534 else {
535 11 my $preceding_char = substr( $expression, $position - 1, 1 );
536 11 ▶ if ( $preceding_char eq $GREATER_THAN_SIGN ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($preceding_char eq $JSON::Path::Evaluator::GREATER_THAN_SIGN) { } 9 2 11
elsif ($preceding_char eq $JSON::Path::Evaluator::LESS_THAN_SIGN) { } 0 2 2
elsif ($preceding_char eq $JSON::Path::Evaluator::EXCLAMATION_MARK) { } 0 2 2
537 9 $operator = $TOKEN_GREATER_EQUAL;
538 }
539 elsif ( $preceding_char eq $LESS_THAN_SIGN ) {
540 0 $operator = $TOKEN_LESS_EQUAL;
541 }
542 elsif ( $preceding_char eq $EXCLAMATION_MARK ) {
543 0 $operator = $TOKEN_NOT_EQUAL;
544 }
545 else {
546 2 $operator = $TOKEN_SINGLE_EQUAL;
547 }
548 }
549 23 ( $lhs, $rhs ) = split /$operator/, $expression, 2;
550 }
551 else {
552 67 for ( grep { $OPERATORS{$_} eq $OPERATOR_TYPE_COMPARISON } keys %OPERATORS ) {
553 317 ▶ next if /$EQUAL_SIGN/;
Branch: 1 branch
BranchTrueFalseTotal
if /$JSON::Path::Evaluator::EQUAL_SIGN/ 192 125 317
554 125 ▶ if ( $expression =~ /$_/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expression =~ /$_/) 65 60 125
555 65 ( $lhs, $rhs ) = split /$_/, $expression, 2;
556 65 $operator = $_;
557 65 last;
558 }
559 }
560 }
561  
562 # FIXME: RHS is assumed to be a single value. This isn't necessarily a safe assumption.
563 90 ▶ if ($operator) {
Branch: 1 branch
BranchTrueFalseTotal
if ($operator) { } 88 2 90
564 88 ▶ $rhs = _normalize( $rhs || '' );
Condition100%2/2
$rhs || ''
l!l
844
MC/DC100%1/1
$rhs || ''
$rhs
Truth table100%2/2
A
A= $rhs
Aresult
11
00
565 88 $lhs = _normalize($lhs);
566 }
567 else {
568 2 $operator = $OPERATOR_IS_TRUE;
569 2 $lhs = $expression;
570 }
571 90 return ( $lhs, $operator, $rhs );
572 }
573  
574 sub _normalize {
575 176 ▶ my $string = shift;
Subroutine _normalize: called CC=1 SCAR=0.0
576  
577 # NB: Stripping spaces *before* stripping quotes allows the caller to quote spaces in an index.
578 # So an index of 'foo ' will be correctly normalized as 'foo', but '"foo "' will normalize to 'foo '.
579 176 $string =~ s/\s+$//; # trim trailing spaces
580 176 $string =~ s/^\s+//; # trim leading spaces
581 176 $string =~ s/^['"](.+)['"]$/$1/; # Strip quotes from index
582 176 return $string;
583 }
584  
585 sub _process_perl {
586 6 ▶ my ( $self, $object, $code ) = @_;
Subroutine _process_perl: called CC=8 SCAR=20.8
587  
588 6 my $cpt = Safe->new;
589 6 $cpt->permit_only( ':base_core', qw/padsv padav padhv padany rv2gv/ );
590 6 ${ $cpt->varglob('root') } = dclone( $self->{root} );
591  
592 6 my @matching;
593 6 ▶ if ( _hashlike($object) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (_hashlike($object)) { } 2 4 6
594 2 for my $index ( keys %{$object} ) {
595 10 local $_ = $object->{$index};
596 10 my $ret = $cpt->reval($code);
597 10 ▶ croak qq{Error in filter: $@} if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 10 10
598 10 ▶ push @matching, $index if $ret;
Branch: 1 branch
BranchTrueFalseTotal
if $ret 2 8 10
599 }
600 }
601 else {
602 4 for my $index ( 0 .. $#{$object} ) {
603 15 local $_ = $object->[$index];
604 15 my $ret = $cpt->reval($code);
605 15 ▶ croak qq{Error in filter: $@} if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 15 15
606 15 ▶ push @matching, $index if $ret;
Branch: 1 branch
BranchTrueFalseTotal
if $ret 7 8 15
607 }
608 }
609 6 return @matching;
610 }
611  
612 sub _compare {
613 143 ▶ my ( $operator, $lhs, $rhs ) = @_;
Subroutine _compare: called CC=19 SCAR=32.7
614  
615 17 ▶ no warnings qw/uninitialized/;
Subroutine BEGIN: called CC=1 SCAR=0.0
616 143 ▶ if ( $operator eq $OPERATOR_IS_TRUE ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($operator eq $OPERATOR_IS_TRUE) 7 136 143
617 7 ▶ return $lhs ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$lhs ? : 3 4 7
618 }
619  
620 136 ▶ my $use_numeric = looks_like_number($lhs) && looks_like_number($rhs);
Condition100%3/3
&looks_like_number($lhs) && &looks_like_number($rhs)
!ll&&!rl&&r
49879
MC/DC100%2/2
&looks_like_number($lhs) && &looks_like_number($rhs)
&looks_like_number($lhs) &looks_like_number($rhs)
Truth table100%3/3
A && B
A= &looks_like_number($lhs)B= &looks_like_number($rhs)
ABresult
0X0
100
111
621  
622 136 ▶ if ( $operator eq '=' || $operator eq '==' || $operator eq '===' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($operator eq "=" or $operator eq "==" or $operator eq "===") 27 105 132
Condition83%5/6
$operator eq "=" or $operator eq "==" or $operator eq "==="
l!l&&r!l&&!r
310105
$operator eq "=" or $operator eq "=="
l!l&&r!l&&!r
427105
MC/DC66%2/3
$operator eq "=" or $operator eq "==" or $operator eq "==="
$operator eq "=" $operator eq "==" $operator eq "==="
Truth table75%3/4
A or B or C
A= $operator eq "="B= $operator eq "=="C= $operator eq "==="
ABCresult
1XX1
01X1
0011
0000
623 31 ▶ return $use_numeric ? ( $lhs == $rhs ) : $lhs eq $rhs;
Branch: 1 branch
BranchTrueFalseTotal
$use_numeric ? : 8 23 31
624 }
625 105 ▶ if ( $operator eq '<' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($operator eq "<") 18 87 105
626 18 ▶ return $use_numeric ? ( $lhs < $rhs ) : $lhs lt $rhs;
Branch: 1 branch
BranchTrueFalseTotal
$use_numeric ? : 18 0 18
627 }
628 87 ▶ if ( $operator eq '>' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($operator eq ">") 69 18 87
629 69 ▶ return $use_numeric ? ( $lhs > $rhs ) : $lhs gt $rhs;
Branch: 1 branch
BranchTrueFalseTotal
$use_numeric ? : 41 28 69
630 }
631 18 ▶ if ( $operator eq '<=' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($operator eq "<=") 0 18 18
632 0 ▶ return $use_numeric ? ( $lhs <= $rhs ) : $lhs le $rhs;
Branch: 1 branch
BranchTrueFalseTotal
$use_numeric ? : 0 0 0
633 }
634 18 ▶ if ( $operator eq '>=' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($operator eq ">=") 18 0 18
635 18 ▶ return $use_numeric ? ( $lhs >= $rhs ) : $lhs ge $rhs;
Branch: 1 branch
BranchTrueFalseTotal
$use_numeric ? : 12 6 18
636 }
637 0 ▶ if ( $operator eq '!=' || $operator eq '!==' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($operator eq "!=" or $operator eq "!==") 0 0 0
Condition0%0/3
$operator eq "!=" or $operator eq "!=="
l!l&&r!l&&!r
000
MC/DC0%0/2
$operator eq "!=" or $operator eq "!=="
$operator eq "!=" $operator eq "!=="
Truth table0%0/3
A or B
A= $operator eq "!="B= $operator eq "!=="
ABresult
1X1
011
000
638 0 ▶ return $use_numeric ? ( $lhs != $rhs ) : $lhs ne $rhs;
Branch: 1 branch
BranchTrueFalseTotal
$use_numeric ? : 0 0 0
639 }
640 17 ▶ use warnings qw/uninitialized/;
Subroutine BEGIN: called CC=1 SCAR=0.0
641 }
642  
643 17 1;
644  
645 __END__
↑ Summary Path/Tokenizer.pm »