line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSON::Validator::Ref; |
2
|
48
|
|
|
48
|
|
318
|
use Mojo::Base -strict; |
|
48
|
|
|
|
|
98
|
|
|
48
|
|
|
|
|
286
|
|
3
|
|
|
|
|
|
|
|
4
|
48
|
|
|
48
|
|
26777
|
use Tie::Hash (); |
|
48
|
|
|
|
|
36959
|
|
|
48
|
|
|
|
|
1010
|
|
5
|
48
|
|
|
48
|
|
279
|
use base 'Tie::StdHash'; |
|
48
|
|
|
|
|
88
|
|
|
48
|
|
|
|
|
25575
|
|
6
|
|
|
|
|
|
|
|
7
|
126
|
|
|
126
|
1
|
687
|
sub fqn { $_[0]->{'%%fqn'} } |
8
|
1457
|
|
|
1457
|
1
|
4100
|
sub ref { $_[0]->{'$ref'} } |
9
|
1517
|
|
|
1517
|
1
|
3292
|
sub schema { $_[0]->{"%%schema"} } |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Make it look like there is only one key in the hash |
12
|
|
|
|
|
|
|
sub EXISTS { |
13
|
5864
|
100
|
|
5864
|
|
27273
|
exists $_[0]->{$_[1]} || exists $_[0]->{"%%schema"}{$_[1]}; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub FETCH { |
17
|
2881
|
100
|
|
2881
|
|
22860
|
exists $_[0]->{$_[1]} ? $_[0]->{$_[1]} : $_[0]->{"%%schema"}{$_[1]}; |
18
|
|
|
|
|
|
|
} |
19
|
168
|
|
|
168
|
|
1634
|
sub FIRSTKEY {'$ref'} |
20
|
0
|
|
|
0
|
0
|
0
|
sub KEYS {'$ref'} |
21
|
168
|
|
|
168
|
|
556
|
sub NEXTKEY {undef} |
22
|
0
|
|
|
0
|
|
0
|
sub SCALAR {1} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub TIEHASH { |
25
|
6904
|
|
|
6904
|
|
17406
|
my ($class, $schema, $ref, $fqn) = @_; |
26
|
6904
|
|
66
|
|
|
69441
|
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 |