line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CPAN::Packager::Config::Validator; |
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
104
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
4
|
1
|
|
|
1
|
|
507
|
use CPAN::Packager::Config::Schema; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
5
|
1
|
|
|
1
|
|
1351
|
use Kwalify; |
|
1
|
|
|
|
|
20041
|
|
|
1
|
|
|
|
|
93
|
|
6
|
1
|
|
|
1
|
|
16
|
use Log::Log4perl qw(:easy); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
17
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub validate { |
9
|
0
|
|
|
0
|
0
|
|
my ( $class, $config ) = @_; |
10
|
0
|
|
|
|
|
|
my $schema = CPAN::Packager::Config::Schema->schema(); |
11
|
0
|
|
|
|
|
|
$class->_validate_config( $config, $schema ); |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub _validate_config { |
15
|
0
|
|
|
0
|
|
|
my ( $class, $config, $schema ) = @_; |
16
|
0
|
0
|
|
|
|
|
if ($schema) { |
17
|
0
|
|
|
|
|
|
my $res = Kwalify::validate( $schema, $config ); |
18
|
0
|
0
|
|
|
|
|
unless ( $res == 1 ) { |
19
|
0
|
|
|
|
|
|
die "config.yaml validation error : $res"; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
else { |
23
|
0
|
|
|
|
|
|
WARN("Kwalify is not installed. Skipping the config validation."); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
__END__ |