OPM.pm

filter: Statementstmt 100% 32 / 32 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 11 / 11 Podpod n/a totaltotal 100% 47 / 47 CC 3 SCAR 2.7
CC
3
Cov
100%
__ANON__
2.0
__ANON__
2.0
BEGIN
1.0
CRAP 1.3
↑ Summary Dist.pm »
1 package Types::OPM;
2  
3 # ABSTRACT: OPM related types
4  
5 9 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 use Type::Library
11 9 ▶ -base,
Subroutine BEGIN: called CC=1 SCAR=0.0
12 9 -declare => qw(OPMVersion OPMVersionWildcard OPMFile);
13  
14 9 ▶use Type::Utils -all;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 9 ▶use Types::Standard -types;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 9 ▶use OPM::Parser;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 declare OPMVersion =>
19 as Str,
20 30 ▶ where {
Subroutine __ANON__: called CC=1 SCAR=0.0
21 30 $_ =~ m{ \A (?: [0-9]+ \. ){2} (?: [0-9]+ ) \z }xms
22 9 };
23  
24 declare OPMVersionWildcard =>
25 as Str,
26 28 ▶ where {
Subroutine __ANON__: called CC=1 SCAR=0.0
27 28 $_ =~ m{
28 \A (?:
29 (?: [0-9]+ \. ){2} (?: [0-9]+ ) |
30 (?: [0-9]+ \. ){1,2} x
31 ) \z
32 }xms
33 9 };
34  
35 declare OPMFile =>
36 as InstanceOf['OPM::Parser'],
37 7 ▶ where {
Subroutine __ANON__: called CC=2 SCAR=6.9
38 7 ▶ $_->opm_file =~ m{\.s?opm\z} and $_->error_string eq '';
Branch: 1 branch
BranchTrueFalseTotal
$_->opm_file =~ /\.s?opm\z/ and $_->error_string eq "" 5 2 7
39 }
40 9 ;
41  
42 coerce OPMFile =>
43 from Str,
44 4 ▶ via {
Subroutine __ANON__: called CC=2 SCAR=6.9
45 4 ▶ return if !-f $_;
Branch: 1 branch
BranchTrueFalseTotal
unless -f $_ 1 3 4
46  
47 3 my $p = OPM::Parser->new( opm_file => $_ );
48 3 $p->parse;
49 3 $p;
50 }
51 9 ;
52  
53 9 1;
54  
55 __END__
↑ Summary Dist.pm »