| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package OTRS::OPM::Maker::Command::sopmtest; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Check if sopm is valid |
|
4
|
|
|
|
|
|
|
|
|
5
|
16
|
|
|
16
|
|
394764
|
use strict; |
|
|
16
|
|
|
|
|
54
|
|
|
|
16
|
|
|
|
|
522
|
|
|
6
|
16
|
|
|
16
|
|
95
|
use warnings; |
|
|
16
|
|
|
|
|
42
|
|
|
|
16
|
|
|
|
|
394
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
16
|
|
|
16
|
|
2872
|
use Path::Class (); |
|
|
16
|
|
|
|
|
216522
|
|
|
|
16
|
|
|
|
|
325
|
|
|
9
|
16
|
|
|
16
|
|
4222
|
use XML::LibXML; |
|
|
16
|
|
|
|
|
301852
|
|
|
|
16
|
|
|
|
|
100
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
16
|
|
|
16
|
|
4915
|
use OTRS::OPM::Maker -command; |
|
|
16
|
|
|
|
|
58
|
|
|
|
16
|
|
|
|
|
197
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.17'; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub abstract { |
|
16
|
1
|
|
|
1
|
1
|
19551
|
return "check .sopm if it is valid"; |
|
17
|
|
|
|
|
|
|
} |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub usage_desc { |
|
20
|
1
|
|
|
1
|
1
|
847
|
return "opmbuild sopmtest "; |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub validate_args { |
|
24
|
8
|
|
|
8
|
1
|
24599
|
my ($self, $opt, $args) = @_; |
|
25
|
|
|
|
|
|
|
|
|
26
|
8
|
100
|
100
|
|
|
132
|
$self->usage_error( 'need path to .sopm' ) if |
|
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
27
|
|
|
|
|
|
|
!$args or |
|
28
|
|
|
|
|
|
|
'ARRAY' ne ref $args or |
|
29
|
|
|
|
|
|
|
!defined $args->[0] or |
|
30
|
|
|
|
|
|
|
$args->[0] !~ /\.sopm\z/ or |
|
31
|
|
|
|
|
|
|
!-f $args->[0]; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub execute { |
|
35
|
7
|
|
|
7
|
1
|
8326
|
my ($self, $opt, $args) = @_; |
|
36
|
|
|
|
|
|
|
|
|
37
|
7
|
|
|
|
|
21
|
my $file = $args->[0]; |
|
38
|
|
|
|
|
|
|
|
|
39
|
7
|
|
|
|
|
15
|
my $check_result; |
|
40
|
|
|
|
|
|
|
my $tree; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
eval { |
|
43
|
7
|
|
|
|
|
72
|
my $parser = XML::LibXML->new; |
|
44
|
7
|
|
|
|
|
180
|
$tree = $parser->parse_file( $file ); |
|
45
|
4
|
|
|
|
|
1688
|
1; |
|
46
|
7
|
100
|
|
|
|
14
|
} or do { print "Cannot parse .sopm: $@\n"; return }; |
|
|
3
|
|
|
|
|
1704
|
|
|
|
3
|
|
|
|
|
165
|
|
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
eval { |
|
49
|
4
|
|
|
|
|
11
|
my $xsd = do{ local $/; }; |
|
|
4
|
|
|
|
|
35
|
|
|
|
4
|
|
|
|
|
218
|
|
|
50
|
4
|
|
|
|
|
44
|
my $schema = XML::LibXML::Schema->new( string => $xsd ); |
|
51
|
4
|
|
|
|
|
11610
|
$schema->validate( $tree ); |
|
52
|
3
|
|
|
|
|
430
|
1; |
|
53
|
4
|
100
|
|
|
|
25
|
} or do { |
|
54
|
1
|
|
|
|
|
188
|
print ".sopm is not valid: $@\n"; |
|
55
|
1
|
|
|
|
|
164
|
return; |
|
56
|
|
|
|
|
|
|
}; |
|
57
|
|
|
|
|
|
|
|
|
58
|
3
|
|
|
|
|
109
|
return 1; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=pod |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=encoding UTF-8 |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 NAME |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
OTRS::OPM::Maker::Command::sopmtest - Check if sopm is valid |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 VERSION |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
version 0.17 |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 AUTHOR |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Renee Baecker |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
This software is Copyright (c) 2017 by Renee Baecker. |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
This is free software, licensed under: |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
__DATA__ |