line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSON::SchemaValidator::Pointer; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
69817
|
use strict; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
125
|
|
4
|
4
|
|
|
4
|
|
21
|
use warnings; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
115
|
|
5
|
4
|
|
|
4
|
|
23
|
use base 'Exporter'; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
480
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our @EXPORT_OK = qw(pointer); |
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
4
|
|
1879
|
use URI::Escape qw(uri_unescape); |
|
4
|
|
|
|
|
5918
|
|
|
4
|
|
|
|
|
961
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub pointer { |
12
|
8
|
|
|
8
|
0
|
3718
|
my ($json, $pointer) = @_; |
13
|
|
|
|
|
|
|
|
14
|
8
|
50
|
|
|
|
40
|
return unless $pointer =~ m/^#/; |
15
|
|
|
|
|
|
|
|
16
|
8
|
|
|
|
|
22
|
$pointer = uri_unescape($pointer); |
17
|
|
|
|
|
|
|
|
18
|
8
|
|
|
|
|
98
|
$pointer =~ s{^#/?}{}; |
19
|
|
|
|
|
|
|
|
20
|
8
|
|
|
|
|
15
|
my $top = $json; |
21
|
8
|
|
|
|
|
23
|
foreach my $part (split m{/}, $pointer) { |
22
|
10
|
|
|
|
|
40
|
$part =~ s{\~1}{\/}g; |
23
|
10
|
|
|
|
|
16
|
$part =~ s{\~0}{\~}g; |
24
|
|
|
|
|
|
|
|
25
|
10
|
100
|
|
|
|
59
|
if (ref $top eq 'HASH') { |
|
|
50
|
|
|
|
|
|
26
|
9
|
|
|
|
|
21
|
$top = $top->{$part}; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
elsif (ref $top eq 'ARRAY') { |
29
|
1
|
|
|
|
|
7
|
$top = $top->[$part]; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
8
|
|
|
|
|
48
|
return $top; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |