line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OPM::Maker::Command::sopmtest; |
2
|
|
|
|
|
|
|
$OPM::Maker::Command::sopmtest::VERSION = '1.15'; |
3
|
|
|
|
|
|
|
# ABSTRACT: Check if sopm is valid |
4
|
|
|
|
|
|
|
|
5
|
21
|
|
|
21
|
|
186701
|
use strict; |
|
21
|
|
|
|
|
59
|
|
|
21
|
|
|
|
|
657
|
|
6
|
21
|
|
|
21
|
|
124
|
use warnings; |
|
21
|
|
|
|
|
61
|
|
|
21
|
|
|
|
|
554
|
|
7
|
|
|
|
|
|
|
|
8
|
21
|
|
|
21
|
|
3761
|
use Path::Class (); |
|
21
|
|
|
|
|
278480
|
|
|
21
|
|
|
|
|
392
|
|
9
|
21
|
|
|
21
|
|
10513
|
use OPM::Validate; |
|
21
|
|
|
|
|
72153
|
|
|
21
|
|
|
|
|
1033
|
|
10
|
|
|
|
|
|
|
|
11
|
21
|
|
|
21
|
|
2024
|
use OPM::Maker -command; |
|
21
|
|
|
|
|
55
|
|
|
21
|
|
|
|
|
196
|
|
12
|
21
|
|
|
21
|
|
80428
|
use OPM::Maker::Utils qw(check_args_sopm); |
|
21
|
|
|
|
|
55
|
|
|
21
|
|
|
|
|
5524
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub abstract { |
15
|
1
|
|
|
1
|
1
|
3842
|
return "check .sopm if it is valid"; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub usage_desc { |
19
|
1
|
|
|
1
|
1
|
1005
|
return "opmbuild sopmtest "; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub validate_args { |
23
|
16
|
|
|
16
|
1
|
20048
|
my ($self, $opt, $args) = @_; |
24
|
|
|
|
|
|
|
|
25
|
16
|
|
|
|
|
65
|
my $sopm = check_args_sopm( $args, 1 ); |
26
|
16
|
100
|
|
|
|
99
|
$self->usage_error( 'need path to .sopm' ) if |
27
|
|
|
|
|
|
|
!$sopm; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub execute { |
31
|
9
|
|
|
9
|
1
|
8579
|
my ($self, $opt, $args) = @_; |
32
|
|
|
|
|
|
|
|
33
|
9
|
|
|
|
|
34
|
my $file = check_args_sopm( $args, 1 ); |
34
|
|
|
|
|
|
|
|
35
|
9
|
100
|
|
|
|
33
|
if ( !defined $file ) { |
36
|
2
|
|
|
|
|
60
|
print "No file given!"; |
37
|
2
|
|
|
|
|
18
|
return; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
7
|
50
|
|
|
|
155
|
if ( !-f $file ) { |
41
|
0
|
|
|
|
|
0
|
print "$file does not exist"; |
42
|
0
|
|
|
|
|
0
|
return; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
eval { |
46
|
7
|
|
|
|
|
13
|
my $content = do{ local (@ARGV, $/) = $file; <> }; |
|
7
|
|
|
|
|
46
|
|
|
7
|
|
|
|
|
484
|
|
47
|
7
|
|
|
|
|
68
|
OPM::Validate->validate( $content, 1 ); |
48
|
4
|
|
|
|
|
2314
|
1; |
49
|
7
|
100
|
|
|
|
20
|
} or do { |
50
|
3
|
|
|
|
|
684
|
print ".sopm is not valid: $@\n"; |
51
|
3
|
|
|
|
|
25
|
return; |
52
|
|
|
|
|
|
|
}; |
53
|
|
|
|
|
|
|
|
54
|
4
|
|
|
|
|
14
|
return 1; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |