line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSON::Validator::Ref; |
2
|
49
|
|
|
49
|
|
374
|
use Mojo::Base -strict; |
|
49
|
|
|
|
|
107
|
|
|
49
|
|
|
|
|
336
|
|
3
|
|
|
|
|
|
|
|
4
|
49
|
|
|
49
|
|
30748
|
use Tie::Hash (); |
|
49
|
|
|
|
|
44304
|
|
|
49
|
|
|
|
|
1161
|
|
5
|
49
|
|
|
49
|
|
332
|
use base 'Tie::StdHash'; |
|
49
|
|
|
|
|
120
|
|
|
49
|
|
|
|
|
30177
|
|
6
|
|
|
|
|
|
|
|
7
|
126
|
|
|
126
|
1
|
815
|
sub fqn { $_[0]->{'%%fqn'} } |
8
|
1457
|
|
|
1457
|
1
|
4284
|
sub ref { $_[0]->{'$ref'} } |
9
|
1517
|
|
|
1517
|
1
|
3250
|
sub schema { $_[0]->{"%%schema"} } |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Make it look like there is only one key in the hash |
12
|
|
|
|
|
|
|
sub EXISTS { |
13
|
6138
|
100
|
|
6138
|
|
30526
|
exists $_[0]->{$_[1]} || exists $_[0]->{"%%schema"}{$_[1]}; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub FETCH { |
17
|
2866
|
100
|
|
2866
|
|
23836
|
exists $_[0]->{$_[1]} ? $_[0]->{$_[1]} : $_[0]->{"%%schema"}{$_[1]}; |
18
|
|
|
|
|
|
|
} |
19
|
168
|
|
|
168
|
|
2406
|
sub FIRSTKEY {'$ref'} |
20
|
0
|
|
|
0
|
0
|
0
|
sub KEYS {'$ref'} |
21
|
168
|
|
|
168
|
|
687
|
sub NEXTKEY {undef} |
22
|
0
|
|
|
0
|
|
0
|
sub SCALAR {1} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub TIEHASH { |
25
|
6904
|
|
|
6904
|
|
18313
|
my ($class, $schema, $ref, $fqn) = @_; |
26
|
6904
|
|
66
|
|
|
72759
|
bless {'$ref' => $ref, "%%fqn" => $fqn // $ref, "%%schema" => $schema}, |
27
|
|
|
|
|
|
|
$class; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# jhthorsen: This cannot return schema() since it might cause circular references |
31
|
0
|
|
|
0
|
0
|
|
sub TO_JSON { {'$ref' => $_[0]->ref} } |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=encoding utf8 |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 NAME |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
JSON::Validator::Ref - JSON::Validator $ref representation |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 SYNOPSIS |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
use JSON::Validator::Ref; |
44
|
|
|
|
|
|
|
my $ref = JSON::Validator::Ref->new({ref => "...", schema => {...}); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
or: |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
tie my %ref, 'JSON::Validator::Ref', $schema, $path; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 DESCRIPTION |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
L is a class representing a C<$ref> inside a JSON Schema. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
This module SHOULD be considered internal to the L project and |
55
|
|
|
|
|
|
|
the API is subject to change. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 fqn |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
$str = $ref->fqn; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
The fully qualified version of L. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 ref |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
$str = $ref->ref; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
The original C<$ref> from the document. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 schema |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
$hash_ref = $ref->schema; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
A reference to the schema that the C points to. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 SEE ALSO |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
L. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |