Midgen/Role/Output.pm

filter: Statementstmt 27.2% 18 / 66 Branchbran 0.0% 0 / 54 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 36.3% 4 / 11 Podpod 100% 5 / 5 totaltotal 19.4% 27 / 139 CC 30 SCAR 43.4
CC
30
Cov
15%
output_header
110.0
output_main_body
110.0
output_footer
90.0
CRAP 76.7
« Midgen/Role/Output/MIdsl.pm ↑ Summary Midgen/Role/Output/EUMM.pm »
1 package App::Midgen::Role::Output;
2  
3 2 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 with qw(
5 App::Midgen::Role::Output::CPANfile
6 App::Midgen::Role::Output::Dist
7 App::Midgen::Role::Output::EUMM
8 App::Midgen::Role::Output::Infile
9 App::Midgen::Role::Output::MB
10 App::Midgen::Role::Output::METAjson
11 App::Midgen::Role::Output::MIdsl
12 App::Midgen::Role::Output::MI
13 );
14 2 requires qw( format distribution_name get_module_version verbose );
15  
16 # Load time and dependencies negate execution time
17 # use namespace::clean -except => 'meta';
18  
19 2 our $VERSION = '0.34';
20 2 $VERSION = eval $VERSION; ## no critic
21  
22 2 ▶use English qw( -no_match_vars ); # Avoids reg-ex performance penalty
Subroutine BEGIN: called CC=1 SCAR=0.0
23 2 local $OUTPUT_AUTOFLUSH = 1;
24  
25 2 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27  
28 #######
29 # output_header
30 #######
31 0 ▶sub output_header {
Subroutine output_header: not called CC=10 SCAR=47.0
Pod documented
32 0 my $self = shift;
33  
34 0 ▶ if ($self->format eq 'dsl') {
Branch: 8 branches
BranchTrueFalseTotal
if ($self->format eq 'dsl') { } 0 0 0
elsif ($self->format eq 'mi') { } 0 0 0
elsif ($self->format eq 'dist') { } 0 0 0
elsif ($self->format eq 'cpanfile') { } 0 0 0
elsif ($self->format eq 'eumm') { } 0 0 0
elsif ($self->format eq 'mb') { } 0 0 0
elsif ($self->format eq 'metajson') { } 0 0 0
elsif ($self->format eq 'infile') { } 0 0 0
35 0 $self->header_dsl($self->distribution_name,
36 $self->get_module_version('inc::Module::Install::DSL'));
37 }
38 elsif ($self->format eq 'mi') {
39 0 $self->header_mi($self->distribution_name,
40 $self->get_module_version('inc::Module::Install'));
41 }
42 elsif ($self->format eq 'dist') {
43 0 $self->header_dist($self->distribution_name);
44 }
45 elsif ($self->format eq 'cpanfile') {
46 0 ▶ $self->header_cpanfile($self->distribution_name,
Branch: 1 branch
BranchTrueFalseTotal
unless $self->quiet 0 0 0
47 $self->get_module_version('inc::Module::Install'))
48 if not $self->quiet;
49 }
50 elsif ($self->format eq 'eumm') {
51 0 $self->header_eumm($self->distribution_name);
52 }
53 elsif ($self->format eq 'mb') {
54 0 $self->header_mb($self->distribution_name);
55 }
56 elsif ($self->format eq 'metajson') {
57 0 $self->header_metajson($self->distribution_name);
58 }
59 elsif ($self->format eq 'infile') {
60 0 $self->header_infile($self->distribution_name);
61 }
62  
63 0 return;
64 }
65  
66 #######
67 # output_main_body
68 #######
69 0 ▶sub output_main_body {
Subroutine output_main_body: not called CC=10 SCAR=47.0
Pod documented
70 0 my $self = shift;
71 0 ▶ my $title = shift || 'title missing';
Condition0%0/2
shift() || 'title missing'
l!l
00
MC/DC0%0/1
shift() || 'title missing'
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
72 0 my $required_ref = shift;
73  
74 0 ▶ if ($self->format eq 'dsl') {
Branch: 8 branches
BranchTrueFalseTotal
if ($self->format eq 'dsl') { } 0 0 0
elsif ($self->format eq 'mi') { } 0 0 0
elsif ($self->format eq 'dist') { } 0 0 0
elsif ($self->format eq 'cpanfile') { } 0 0 0
elsif ($self->format eq 'eumm') { } 0 0 0
elsif ($self->format eq 'mb') { } 0 0 0
elsif ($self->format eq 'metajson') { } 0 0 0
elsif ($self->format eq 'infile') { } 0 0 0
75 0 $self->body_dsl($title, $required_ref);
76 }
77 elsif ($self->format eq 'mi') {
78 0 $self->body_mi($title, $required_ref);
79 }
80 elsif ($self->format eq 'dist') {
81 0 $self->body_dist($title, $required_ref);
82 }
83 elsif ($self->format eq 'cpanfile') {
84 0 $self->body_cpanfile($title, $required_ref);
85 }
86 elsif ($self->format eq 'eumm') {
87 0 $self->body_eumm($title, $required_ref);
88 }
89 elsif ($self->format eq 'mb') {
90 0 $self->body_mb($title, $required_ref);
91 }
92 elsif ($self->format eq 'metajson') {
93 0 $self->body_metajson($title, $required_ref);
94 }
95 elsif ($self->format eq 'infile') {
96 0 $self->body_infile($title, $required_ref);
97 }
98  
99 0 return;
100 }
101  
102 #######
103 # output_footer
104 #######
105 0 ▶sub output_footer {
Subroutine output_footer: not called CC=9 SCAR=45.0
Pod documented
106 0 my $self = shift;
107  
108 0 ▶ if ($self->format eq 'dsl') {
Branch: 8 branches
BranchTrueFalseTotal
if ($self->format eq 'dsl') { } 0 0 0
elsif ($self->format eq 'mi') { } 0 0 0
elsif ($self->format eq 'dist') { } 0 0 0
elsif ($self->format eq 'cpanfile') { } 0 0 0
elsif ($self->format eq 'eumm') { } 0 0 0
elsif ($self->format eq 'mb') { } 0 0 0
elsif ($self->format eq 'metajson') { } 0 0 0
elsif ($self->format eq 'infile') { } 0 0 0
109 0 $self->footer_dsl($self->distribution_name);
110 }
111 elsif ($self->format eq 'mi') {
112 0 $self->footer_mi($self->distribution_name);
113 }
114 elsif ($self->format eq 'dist') {
115 0 $self->footer_dist($self->distribution_name);
116 }
117 elsif ($self->format eq 'cpanfile') {
118 0 $self->footer_cpanfile($self->distribution_name);
119 }
120 elsif ($self->format eq 'eumm') {
121 0 $self->footer_eumm($self->distribution_name);
122 }
123 elsif ($self->format eq 'mb') {
124 0 $self->footer_mb($self->distribution_name);
125 }
126 elsif ($self->format eq 'metajson') {
127 0 $self->footer_metajson($self->distribution_name);
128 }
129 elsif ($self->format eq 'infile') {
130 0 $self->footer_infile($self->distribution_name);
131 }
132  
133 0 return;
134 }
135  
136 #######
137 # no_index
138 #######
139 0 ▶sub no_index {
Subroutine no_index: not called CC=3 SCAR=24.8
Pod documented
140 0 my $self = shift;
141  
142 #ToDo add more options as and when
143 my @dirs_to_check
144 0 = qw( corpus eg examples fbp inc maint misc privinc share t xt );
145 0 my @dirs_found;
146  
147 0 foreach my $dir (@dirs_to_check) {
148  
149 #ignore syntax warning for global
150 0 ▶ push @dirs_found, $dir
Branch: 1 branch
BranchTrueFalseTotal
if -d "File::Spec"->catdir($App::Midgen::Working_Dir, $dir) 0 0 0
151 if -d File::Spec->catdir($App::Midgen::Working_Dir, $dir);
152 }
153 0 return @dirs_found;
154 }
155  
156 #######
157 # in_local_lib
158 #######
159 0 ▶sub in_local_lib {
Subroutine in_local_lib: not called CC=2 SCAR=17.9
Pod documented
160 0 my $self = shift;
161 0 my $found_module = shift;
162  
163 # exemption for perl :)
164 # return $PERL_VERSION if $found_module eq 'perl';
165 0 ▶ return $] if $found_module eq 'perl';
Branch: 1 branch
BranchTrueFalseTotal
if $found_module eq "perl" 0 0 0
166  
167 0 ▶ try {
Subroutine __ANON__: not called CC=1 SCAR=6.9
168 # Show installed version-string
169 # hack from Module::Vesrion
170 0 require ExtUtils::MakeMaker;
171 0 return MM->parse_version(MM->_installed_file_for_module($found_module));
172 }
173 0 ▶ catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
174 # module not installed in local-lib
175 0 return colored('Missing ', 'red');
176 0 };
177 #return; don't follow pbp as it F's-up
178 }
179  
180  
181 2 ▶no Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
182  
183 2 1;
184  
185 __END__
« Midgen/Role/Output/MIdsl.pm ↑ Summary Midgen/Role/Output/EUMM.pm »