Midgen/Role/Output/Infile.pm

filter: Statementstmt 45.3% 29 / 64 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 61.5% 8 / 13 Podpod 100% 3 / 3 totaltotal 40.4% 40 / 99 CC 13 SCAR 38.4
CC
13
Cov
36%
footer_infile
110.0
__ANON__
12.0
__ANON__
6.0
CRAP 46.4
« Midgen/Role/Heuristics.pm ↑ Summary Midgen/Role/Output/MB.pm »
1 package App::Midgen::Role::Output::Infile;
2  
3 2 ▶use constant {
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 BLANK => q{ },
5 NONE => q{},
6 THREE => 3,
7 EIGHT => 8,
8 NINE => 9,
9 TEN => 10
10 2 };
11  
12 2 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 requires qw( core dual_life debug );
14 2 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
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 );
Subroutine BEGIN: called CC=1 SCAR=0.0
23 2 local $OUTPUT_AUTOFLUSH = 1;
24  
25 2 ▶use Term::ANSIColor qw( :constants colored );
Subroutine BEGIN: called CC=1 SCAR=0.0
26 2 ▶use Data::Printer {caller_info => 1,};
Subroutine BEGIN: called CC=1 SCAR=0.0
27 2 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29 #######
30 # header_infile
31 #######
32 0 ▶sub header_infile {
Subroutine header_infile: not called CC=1 SCAR=6.9
Pod documented
33 0 my $self = shift;
34  
35 0 print qq{\n};
36  
37 0 return;
38 }
39 #######
40 # body_infile
41 #######
42 0 ▶sub body_infile {
Subroutine body_infile: not called CC=1 SCAR=6.9
Pod documented
43 0 my $self = shift;
44  
45 0 return;
46 }
47 #######
48 # footer_infile
49 #######
50 0 ▶sub footer_infile {
Subroutine footer_infile: not called CC=10 SCAR=47.0
Pod documented
51 0 my $self = shift;
52  
53 0 ▶ p $self->{modules} if $self->debug;
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug 0 0 0
54  
55 # Let's work out our padding
56 0 my $pm_length = 0;
57 0 my $dir_length = 0;
58 0 foreach my $module_name (sort keys %{$self->{modules}}) {
59  
60 0 ▶ if (length $module_name > $pm_length) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $module_name > $pm_length) 0 0 0
61 0 $pm_length = length $module_name;
62 }
63 0 ▶ try {
Subroutine __ANON__: not called CC=3 SCAR=24.8
64 0 foreach my $foundin (sort @{$self->{modules}{$module_name}{infiles}}) {
65 0 ▶ if (length $foundin->[0] > $dir_length) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $foundin->[0] > $dir_length) 0 0 0
66 0 $dir_length = length $foundin->[0];
67 }
68 }
69 0 };
70  
71 }
72  
73 0 print " "
74 . "-" x $pm_length
75 . "-" x EIGHT
76 . "-" x TEN
77 . "-" x $dir_length
78 . "-" x TEN . "\n";
79  
80  
81 0 printf " | %-*s | %-*s | %-*s | %-*s |\n", $pm_length, 'Module', EIGHT,
82 'Version ', EIGHT, 'Installed', $dir_length, 'Found in';
83 0 print " "
84 . "-" x $pm_length
85 . "-" x EIGHT
86 . "-" x TEN
87 . "-" x $dir_length
88 . "-" x TEN . "\n";
89  
90  
91 0 foreach my $module_name (sort keys %{$self->{modules}}) {
92  
93 # honnor options dual-life and core module display
94 0 ▶ if ($self->core) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->core) { } 0 0 0
elsif ($self->dual_life) { } 0 0 0
95  
96 # do nothing
97 }
98 elsif ($self->dual_life) {
99 next
100 if ($self->{modules}{$module_name}{corelist}
101 0 ▶ and not $self->{modules}{$module_name}{dual_life});
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"modules"}{$module_name}{"corelist"} and not $self->{"modules"}{$module_name}{"dual_life"} 0 0 0
Condition0%0/3
$self->{"modules"}{$module_name}{"corelist"} and not $self->{"modules"}{$module_name}{"dual_life"}
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"modules"}{$module_name}{"corelist"} and not $self->{"modules"}{$module_name}{"dual_life"}
$self->{"modules"}{$module_name}{"corelist"} not $self->{"modules"}{$module_name}{"dual_life"}
Truth table0%0/3
A and not(B)
A= $self->{"modules"}{$module_name}{"corelist"}B= not $self->{"modules"}{$module_name}{"dual_life"}
ABresult
0X0
100
111
102 }
103 else {
104 0 ▶ next if $self->{modules}{$module_name}{corelist};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"modules"}{$module_name}{"corelist"} 0 0 0
105 }
106  
107 0 ▶ try {
Subroutine __ANON__: not called CC=2 SCAR=17.9
108 0 foreach my $foundin (sort @{$self->{modules}{$module_name}{infiles}}) {
109 0 my $dir_relative = $foundin->[0];
110 0 $dir_relative =~ s{^/}{};
111 0 printf " | %-*s | %-*s | %-*s | %-*s |\n", $pm_length, $module_name,
112 EIGHT, $foundin->[1], NINE, $self->in_local_lib($module_name),
113 $dir_length, $dir_relative,;
114 }
115 0 };
116 }
117  
118 0 print " "
119 . "-" x $pm_length
120 . "-" x EIGHT
121 . "-" x TEN
122 . "-" x $dir_length
123 . "-" x TEN . "\n";
124  
125 0 print qq{\n};
126  
127 0 return;
128 }
129  
130 2 ▶no Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
131  
132 2 1;
133  
134 __END__
« Midgen/Role/Heuristics.pm ↑ Summary Midgen/Role/Output/MB.pm »