line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Sereal::Path; |
2
|
6
|
|
|
6
|
|
2168
|
use 5.008; |
|
6
|
|
|
|
|
56
|
|
3
|
6
|
|
|
6
|
|
41
|
use strict; |
|
6
|
|
|
|
|
19
|
|
|
6
|
|
|
|
|
147
|
|
4
|
6
|
|
|
6
|
|
33
|
use warnings; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
181
|
|
5
|
6
|
|
|
6
|
|
35
|
use Carp qw/croak/; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
358
|
|
6
|
6
|
|
|
6
|
|
39
|
use XSLoader; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
149
|
|
7
|
6
|
|
|
6
|
|
1781
|
use Sereal::Path::Iterator; |
|
6
|
|
|
|
|
20
|
|
|
6
|
|
|
|
|
2473
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '4.004'; |
10
|
|
|
|
|
|
|
our $XS_VERSION = $VERSION; $VERSION= eval $VERSION; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
XSLoader::load(__PACKAGE__, $XS_VERSION); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub _normalize { |
15
|
60
|
|
|
60
|
|
101
|
my ($self, $x) = @_; |
16
|
|
|
|
|
|
|
#$x =~ s/[\['](\??\(.*?\))[\]']/_callback_01($self,$1)/eg; |
17
|
60
|
|
|
|
|
411
|
$x =~ s/'?\.'?|\['?/;/g; |
18
|
60
|
|
|
|
|
139
|
$x =~ s/;;;|;;/;..;/g; |
19
|
60
|
|
|
|
|
226
|
$x =~ s/;\$|'?\]|'$//g; |
20
|
|
|
|
|
|
|
#$x =~ s/#([0-9]+)/_callback_02($self,$1)/eg; |
21
|
|
|
|
|
|
|
#$self->{'result'} = []; # result array was temporarily used as a buffer |
22
|
60
|
|
|
|
|
144
|
return $x; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub traverse { |
26
|
60
|
|
|
60
|
0
|
96
|
my ($self, $query) = @_; |
27
|
60
|
|
|
|
|
125
|
my $norm = $self->_normalize($query); |
28
|
60
|
|
|
|
|
162
|
$norm =~ s/^\$;//; |
29
|
60
|
|
|
|
|
159
|
my @expr = split(/;/, $norm); |
30
|
60
|
|
|
|
|
690
|
$self->_traverse(\@expr, '$'); |
31
|
60
|
|
|
|
|
217
|
return $self->results; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub value { |
35
|
4
|
|
|
4
|
0
|
166
|
my ($self, $query) = @_; |
36
|
4
|
|
|
|
|
14
|
my $values = $self->traverse($query); |
37
|
4
|
|
|
|
|
33
|
return $values->[0]; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub values { |
41
|
56
|
|
|
56
|
0
|
46135
|
my ($self, $query) = @_; |
42
|
56
|
|
|
|
|
121
|
my $values = $self->traverse($query); |
43
|
56
|
100
|
|
|
|
243
|
return wantarray ? @$values : scalar @$values; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__END__ |