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