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