| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
5
|
|
|
5
|
|
141174
|
use strict; |
|
|
5
|
|
|
|
|
8
|
|
|
|
5
|
|
|
|
|
158
|
|
|
2
|
5
|
|
|
5
|
|
18
|
use warnings; |
|
|
5
|
|
|
|
|
6
|
|
|
|
5
|
|
|
|
|
383
|
|
|
3
|
|
|
|
|
|
|
package YAML::PP::Schema::Catchall; |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = 'v0.39.0'; # VERSION |
|
6
|
|
|
|
|
|
|
|
|
7
|
5
|
|
|
5
|
|
24
|
use Carp qw/ croak /; |
|
|
5
|
|
|
|
|
5
|
|
|
|
5
|
|
|
|
|
339
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
5
|
|
|
5
|
|
387
|
use YAML::PP::Common qw/ YAML_PLAIN_SCALAR_STYLE YAML_SINGLE_QUOTED_SCALAR_STYLE /; |
|
|
5
|
|
|
|
|
8
|
|
|
|
5
|
|
|
|
|
1915
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub register { |
|
12
|
589
|
|
|
589
|
0
|
1719
|
my ($self, %args) = @_; |
|
13
|
589
|
|
|
|
|
1054
|
my $schema = $args{schema}; |
|
14
|
589
|
|
|
|
|
820
|
my $options = $args{options}; |
|
15
|
589
|
|
|
|
|
838
|
my $empty_null = 0; |
|
16
|
589
|
|
|
|
|
1165
|
for my $opt (@$options) { |
|
17
|
0
|
0
|
|
|
|
0
|
if ($opt eq 'empty=str') { |
|
|
|
0
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
elsif ($opt eq 'empty=null') { |
|
20
|
0
|
|
|
|
|
0
|
$empty_null = 1; |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
else { |
|
23
|
0
|
|
|
|
|
0
|
croak "Invalid option for JSON Schema: '$opt'"; |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
$schema->add_resolver( |
|
28
|
|
|
|
|
|
|
tag => qr{^(?:!|tag:)}, |
|
29
|
|
|
|
|
|
|
match => [ all => sub { |
|
30
|
38
|
|
|
38
|
|
61
|
my ($constructor, $event) = @_; |
|
31
|
38
|
|
|
|
|
77
|
my $value = $event->{value}; |
|
32
|
38
|
|
|
|
|
131
|
return $value; |
|
33
|
589
|
|
|
|
|
4224
|
}], |
|
34
|
|
|
|
|
|
|
implicit => 0, |
|
35
|
|
|
|
|
|
|
); |
|
36
|
|
|
|
|
|
|
$schema->add_sequence_resolver( |
|
37
|
|
|
|
|
|
|
tag => qr{^(?:!|tag:)}, |
|
38
|
|
|
|
|
|
|
on_data => sub { |
|
39
|
14
|
|
|
14
|
|
23
|
my ($constructor, $ref, $list) = @_; |
|
40
|
14
|
|
|
|
|
39
|
push @$$ref, @$list; |
|
41
|
|
|
|
|
|
|
}, |
|
42
|
589
|
|
|
|
|
3282
|
); |
|
43
|
|
|
|
|
|
|
$schema->add_mapping_resolver( |
|
44
|
|
|
|
|
|
|
tag => qr{^(?:!|tag:)}, |
|
45
|
|
|
|
|
|
|
on_data => sub { |
|
46
|
28
|
|
|
28
|
|
53
|
my ($constructor, $ref, $list) = @_; |
|
47
|
28
|
|
|
|
|
75
|
for (my $i = 0; $i < @$list; $i += 2) { |
|
48
|
54
|
|
|
|
|
226
|
$$ref->{ $list->[ $i ] } = $list->[ $i + 1 ]; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
}, |
|
51
|
589
|
|
|
|
|
3129
|
); |
|
52
|
|
|
|
|
|
|
|
|
53
|
589
|
|
|
|
|
2641
|
return; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=pod |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=encoding utf-8 |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 NAME |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
YAML::PP::Schema::JSON - YAML 1.2 JSON Schema |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
my $yp = YAML::PP->new( schema => ['JSON'] ); |
|
71
|
|
|
|
|
|
|
my $yp = YAML::PP->new( schema => [qw/ JSON empty=str /] ); |
|
72
|
|
|
|
|
|
|
my $yp = YAML::PP->new( schema => [qw/ JSON empty=null /] ); |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=cut |