line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OPM::Maker::Command::sopmtest; |
2
|
|
|
|
|
|
|
$OPM::Maker::Command::sopmtest::VERSION = '1.16'; |
3
|
|
|
|
|
|
|
# ABSTRACT: Check if sopm is valid |
4
|
|
|
|
|
|
|
|
5
|
21
|
|
|
21
|
|
238533
|
use strict; |
|
21
|
|
|
|
|
75
|
|
|
21
|
|
|
|
|
750
|
|
6
|
21
|
|
|
21
|
|
125
|
use warnings; |
|
21
|
|
|
|
|
39
|
|
|
21
|
|
|
|
|
687
|
|
7
|
|
|
|
|
|
|
|
8
|
21
|
|
|
21
|
|
3930
|
use Path::Class (); |
|
21
|
|
|
|
|
303417
|
|
|
21
|
|
|
|
|
568
|
|
9
|
21
|
|
|
21
|
|
12175
|
use OPM::Validate; |
|
21
|
|
|
|
|
76466
|
|
|
21
|
|
|
|
|
1129
|
|
10
|
|
|
|
|
|
|
|
11
|
21
|
|
|
21
|
|
2590
|
use OPM::Maker -command; |
|
21
|
|
|
|
|
55
|
|
|
21
|
|
|
|
|
233
|
|
12
|
21
|
|
|
21
|
|
97830
|
use OPM::Maker::Utils qw(check_args_sopm); |
|
21
|
|
|
|
|
59
|
|
|
21
|
|
|
|
|
6136
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub abstract { |
15
|
1
|
|
|
1
|
1
|
3929
|
return "check .sopm if it is valid"; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub usage_desc { |
19
|
1
|
|
|
1
|
1
|
1096
|
return "opmbuild sopmtest "; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub validate_args { |
23
|
16
|
|
|
16
|
1
|
17835
|
my ($self, $opt, $args) = @_; |
24
|
|
|
|
|
|
|
|
25
|
16
|
|
|
|
|
61
|
my $sopm = check_args_sopm( $args, 1 ); |
26
|
16
|
100
|
|
|
|
91
|
$self->usage_error( 'need path to .sopm' ) if |
27
|
|
|
|
|
|
|
!$sopm; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub execute { |
31
|
9
|
|
|
9
|
1
|
9527
|
my ($self, $opt, $args) = @_; |
32
|
|
|
|
|
|
|
|
33
|
9
|
|
|
|
|
38
|
my $file = check_args_sopm( $args, 1 ); |
34
|
|
|
|
|
|
|
|
35
|
9
|
100
|
|
|
|
36
|
if ( !defined $file ) { |
36
|
2
|
|
|
|
|
63
|
print "No file given!"; |
37
|
2
|
|
|
|
|
17
|
return; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
7
|
50
|
|
|
|
96
|
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
|
|
|
|
|
53
|
|
|
7
|
|
|
|
|
573
|
|
47
|
7
|
|
|
|
|
82
|
OPM::Validate->validate( $content, 1 ); |
48
|
4
|
|
|
|
|
2683
|
1; |
49
|
7
|
100
|
|
|
|
22
|
} or do { |
50
|
3
|
|
|
|
|
731
|
print ".sopm is not valid: $@\n"; |
51
|
3
|
|
|
|
|
25
|
return; |
52
|
|
|
|
|
|
|
}; |
53
|
|
|
|
|
|
|
|
54
|
4
|
|
|
|
|
14
|
return 1; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |