Midgen/Role/Options.pm

filter: Statementstmt 85.0% 34 / 40 Branchbran 25.0% 1 / 4 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 92.3% 12 / 13 Podpod n/a totaltotal 71.2% 47 / 66 CC 5 SCAR 17.2
CC
5
Cov
70%
__ANON__
20.0
__ANON__
2.0
BEGIN
1.0
CRAP 5.6
« Midgen/Role/FindMinVersion.pm ↑ Summary Midgen/Role/Attributes.pm »
1 package App::Midgen::Role::Options;
2  
3 2 ▶use Types::Standard qw( Bool Int );
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 # Load time and dependencies negate execution time
7 # use namespace::clean -except => 'meta';
8  
9 2 our $VERSION = '0.34';
10 2 $VERSION = eval $VERSION; ## no critic
11  
12 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 #######
15 # cmd line options
16 #######
17  
18 has 'core' => (
19 is => 'ro',
20 isa => Bool,
21 2 ▶ default => sub {0},
Subroutine __ANON__: called CC=1 SCAR=0.0
22 2 required => 1,
23 );
24  
25 has 'debug' => (
26 is => 'ro',
27 isa => Bool,
28 2 ▶ default => sub {0},
Subroutine __ANON__: called CC=1 SCAR=0.0
29 2 required => 1,
30 );
31  
32 has 'dual_life' => (
33 is => 'ro',
34 isa => Bool,
35 2 ▶ default => sub {0},
Subroutine __ANON__: called CC=1 SCAR=0.0
36 2 required => 1,
37 );
38  
39 has 'experimental' => (
40 is => 'ro',
41 isa => Bool,
42 2 ▶ default => sub {0},
Subroutine __ANON__: called CC=1 SCAR=0.0
43 2 required => 1,
44 );
45  
46 has 'format' => (
47 is => 'ro',
48 3 ▶ isa => sub {
Subroutine __ANON__: called CC=2 SCAR=7.1
49 3 my $format = {
50 dsl => 1,
51 mi => 1,
52 mb => 1,
53 eumm => 1,
54 dist => 1,
55 cpanfile => 1,
56 metajson => 1,
57 infile => 1
58 };
59 3 ▶ croak 'not a supported output format' unless defined $format->{ $_[0] };
Branch: 1 branch
BranchTrueFalseTotal
unless defined $$format{$_[0]} 0 3 3
60 3 return;
61 },
62 2 default => 'dsl',
63 required => 1,
64 );
65  
66 has 'quiet' => (
67 is => 'ro',
68 isa => Bool,
69 3 ▶ default => sub {0},
Subroutine __ANON__: called CC=1 SCAR=0.0
70 2 required => 1,
71 );
72  
73 has 'verbose' => (
74 is => 'ro',
75 isa => Int,
76 2 ▶ default => sub {1},
Subroutine __ANON__: called CC=1 SCAR=0.0
77 2 required => 1,
78 );
79  
80 has 'zero' => (
81 is => 'ro',
82 isa => Bool,
83 2 ▶ default => sub {0},
Subroutine __ANON__: called CC=1 SCAR=0.0
84 2 required => 1,
85 );
86  
87 0 ▶around [qw( debug verbose )] => sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
88 0 my $orig = shift;
89 0 my $self = shift;
90 0 my $content = $self->$orig(@_);
91  
92 0 ▶ if ( ( $self->quiet == 1 && $self->experimental == 1 )
Branch: 1 branch
BranchTrueFalseTotal
if ($self->quiet == 1 and $self->experimental == 1 or $self->format eq 'infile') { } 0 0 0
Condition0%0/6
$self->quiet == 1 and $self->experimental == 1 or $self->format eq "infile"
l!l&&r!l&&!r
000
$self->quiet == 1 and $self->experimental == 1
!ll&&!rl&&r
000
MC/DC0%0/3
$self->quiet == 1 and $self->experimental == 1 or $self->format eq "infile"
$self->quiet == 1 $self->experimental == 1 $self->format eq "infile"
Truth table0%0/5
A and B or C
A= $self->quiet == 1B= $self->experimental == 1C= $self->format eq "infile"
ABCresult
11X1
0X11
1011
0X00
1000
93 || ( $self->format eq 'infile' ) )
94 {
95 0 return 0;
96 } else {
97 0 return $content;
98 }
99 2 };
100  
101  
102 2 ▶no Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
103  
104 2 1;
105  
106 __END__
« Midgen/Role/FindMinVersion.pm ↑ Summary Midgen/Role/Attributes.pm »