line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OPM::Maker::Command::sopmtest; |
2
|
|
|
|
|
|
|
$OPM::Maker::Command::sopmtest::VERSION = '1.17'; |
3
|
|
|
|
|
|
|
# ABSTRACT: Check if sopm is valid |
4
|
|
|
|
|
|
|
|
5
|
21
|
|
|
21
|
|
199636
|
use strict; |
|
21
|
|
|
|
|
59
|
|
|
21
|
|
|
|
|
598
|
|
6
|
21
|
|
|
21
|
|
102
|
use warnings; |
|
21
|
|
|
|
|
39
|
|
|
21
|
|
|
|
|
561
|
|
7
|
|
|
|
|
|
|
|
8
|
21
|
|
|
21
|
|
3157
|
use Path::Class (); |
|
21
|
|
|
|
|
243632
|
|
|
21
|
|
|
|
|
432
|
|
9
|
21
|
|
|
21
|
|
9575
|
use OPM::Validate; |
|
21
|
|
|
|
|
61987
|
|
|
21
|
|
|
|
|
907
|
|
10
|
|
|
|
|
|
|
|
11
|
21
|
|
|
21
|
|
2144
|
use OPM::Maker -command; |
|
21
|
|
|
|
|
48
|
|
|
21
|
|
|
|
|
212
|
|
12
|
21
|
|
|
21
|
|
77016
|
use OPM::Maker::Utils qw(check_args_sopm); |
|
21
|
|
|
|
|
51
|
|
|
21
|
|
|
|
|
4945
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub abstract { |
15
|
1
|
|
|
1
|
1
|
3028
|
return "check .sopm if it is valid"; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub usage_desc { |
19
|
1
|
|
|
1
|
1
|
766
|
return "opmbuild sopmtest "; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub validate_args { |
23
|
16
|
|
|
16
|
1
|
14417
|
my ($self, $opt, $args) = @_; |
24
|
|
|
|
|
|
|
|
25
|
16
|
|
|
|
|
40
|
my $sopm = check_args_sopm( $args, 1 ); |
26
|
16
|
100
|
|
|
|
68
|
$self->usage_error( 'need path to .sopm' ) if |
27
|
|
|
|
|
|
|
!$sopm; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub execute { |
31
|
9
|
|
|
9
|
1
|
7416
|
my ($self, $opt, $args) = @_; |
32
|
|
|
|
|
|
|
|
33
|
9
|
|
|
|
|
32
|
my $file = check_args_sopm( $args, 1 ); |
34
|
|
|
|
|
|
|
|
35
|
9
|
100
|
|
|
|
32
|
if ( !defined $file ) { |
36
|
2
|
|
|
|
|
51
|
print "No file given!"; |
37
|
2
|
|
|
|
|
14
|
return; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
7
|
50
|
|
|
|
112
|
if ( !-f $file ) { |
41
|
0
|
|
|
|
|
0
|
print "$file does not exist"; |
42
|
0
|
|
|
|
|
0
|
return; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
eval { |
46
|
7
|
|
|
|
|
10
|
my $content = do{ local (@ARGV, $/) = $file; <> }; |
|
7
|
|
|
|
|
40
|
|
|
7
|
|
|
|
|
417
|
|
47
|
7
|
|
|
|
|
64
|
OPM::Validate->validate( $content, 1 ); |
48
|
4
|
|
|
|
|
2184
|
1; |
49
|
7
|
100
|
|
|
|
16
|
} or do { |
50
|
3
|
|
|
|
|
598
|
print ".sopm is not valid: $@\n"; |
51
|
3
|
|
|
|
|
20
|
return; |
52
|
|
|
|
|
|
|
}; |
53
|
|
|
|
|
|
|
|
54
|
4
|
|
|
|
|
22
|
return 1; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |