line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::YADV; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
127924
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
42
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
5
|
1
|
|
|
1
|
|
17
|
use v5.008_001; |
|
1
|
|
|
|
|
13
|
|
|
1
|
|
|
|
|
71
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.001'; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
646
|
use Data::YADV::Structure; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
25
|
|
10
|
1
|
|
|
1
|
|
994
|
use String::CamelCase 'camelize'; |
|
1
|
|
|
|
|
564
|
|
|
1
|
|
|
|
|
378
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
11
|
|
|
11
|
0
|
15925
|
my ($class, $structure, %args) = @_; |
14
|
|
|
|
|
|
|
|
15
|
11
|
|
50
|
|
|
38
|
$args{error_handler} ||= \&_error_handler; |
16
|
|
|
|
|
|
|
|
17
|
11
|
|
|
|
|
55
|
bless {%args, structure => Data::YADV::Structure->new($structure)}, |
18
|
|
|
|
|
|
|
$class; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub check { |
22
|
11
|
|
|
11
|
0
|
24
|
my ($self, $schema, @path) = @_; |
23
|
|
|
|
|
|
|
|
24
|
11
|
|
|
|
|
24
|
my $module = $self->schema_to_module($schema); |
25
|
11
|
|
|
|
|
257
|
my $child = $self->{structure}->get_child(@path); |
26
|
11
|
|
|
|
|
28
|
$self->build_checker($module, $child)->verify(); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub schema_to_module { |
30
|
15
|
|
|
15
|
0
|
21
|
my ($self, $schema) = @_; |
31
|
|
|
|
|
|
|
|
32
|
15
|
|
|
|
|
47
|
'Schema::' . camelize($schema); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub build_checker { |
36
|
23
|
|
|
23
|
0
|
45
|
my ($self, $module, @args) = @_; |
37
|
|
|
|
|
|
|
|
38
|
23
|
|
|
|
|
156
|
$module->new( |
39
|
|
|
|
|
|
|
@args, |
40
|
|
|
|
|
|
|
schema => $self, |
41
|
|
|
|
|
|
|
error_cb => $self->{error_handler} |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub _error_handler { |
46
|
0
|
|
|
0
|
|
|
my ($path, $message) = @_; |
47
|
0
|
|
|
|
|
|
warn "$path: $message\n"; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
__END__ |