Midgen/Role/Output/MB.pm

filter: Statementstmt 33.9% 19 / 56 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 62.5% 5 / 8 Podpod 100% 3 / 3 totaltotal 30.0% 27 / 90 CC 12 SCAR 35.4
CC
12
Cov
25%
body_mb
72.0
header_mb
12.0
footer_mb
12.0
CRAP 34.4
« Midgen/Role/Output/Infile.pm ↑ Summary Midgen/Role/FindMinVersion.pm »
1 package App::Midgen::Role::Output::MB;
2  
3 2 ▶use constant {NONE => q{},};
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 2 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 # Load time and dependencies negate execution time
8 # use namespace::clean -except => 'meta';
9  
10 2 our $VERSION = '0.34';
11 2 $VERSION = eval $VERSION; ## no critic
12  
13 2 ▶use English qw( -no_match_vars ); # Avoids reg-ex performance penalty
Subroutine BEGIN: called CC=1 SCAR=0.0
14 2 local $OUTPUT_AUTOFLUSH = 1;
15  
16 2 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 #######
19 # header_mb
20 #######
21 0 ▶sub header_mb {
Subroutine header_mb: not called CC=3 SCAR=24.8
Pod documented
22 0 my $self = shift;
23 0 ▶ my $package_name = shift || NONE;
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
24  
25 0 ▶ if ($package_name ne NONE) {
Branch: 1 branch
BranchTrueFalseTotal
if ($package_name ne "") 0 0 0
26 0 $package_name =~ s{::}{-}g;
27 0 print "\n" . '"dist_name" => "' . $package_name . q{",} . "\n";
28 }
29  
30 0 return;
31 }
32 #######
33 # body_mb
34 #######
35 0 ▶sub body_mb {
Subroutine body_mb: not called CC=8 SCAR=42.8
Pod documented
36 0 my $self = shift;
37 0 my $title = shift;
38 0 ▶ my $required_ref = shift || return;
Condition0%0/2
shift() || (return)
l!l
00
MC/DC0%0/1
shift() || (return)
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
39  
40 0 ▶ return if not %{$required_ref};
Branch: 1 branch
BranchTrueFalseTotal
unless %{$required_ref;} 0 0 0
41  
42 0 print "\n";
43  
44 0 my $pm_length = 0;
45 0 foreach my $module_name (sort keys %{$required_ref}) {
46 0 ▶ if (length $module_name > $pm_length) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $module_name > $pm_length) 0 0 0
47 0 $pm_length = length $module_name;
48 }
49 }
50  
51 0 $title =~ s/^RuntimeRequires/requires/;
52 0 $title =~ s/^TestRequires/test_requires/;
53  
54 0 print q{"} . lc $title . '" => {' . "\n";
55  
56 0 foreach my $module_name (sort keys %{$required_ref}) {
57  
58 next
59 if $title eq 'test_requires'
60 0 ▶ && $required_ref->{$module_name} =~ m/mcpan/;
Branch: 1 branch
BranchTrueFalseTotal
if $title eq "test_requires" and $required_ref->{$module_name} =~ /mcpan/ 0 0 0
Condition0%0/3
$title eq "test_requires" and $required_ref->{$module_name} =~ /mcpan/
!ll&&!rl&&r
000
MC/DC0%0/2
$title eq "test_requires" and $required_ref->{$module_name} =~ /mcpan/
$title eq "test_requires" $required_ref->{$module_name} =~ /mcpan/
Truth table0%0/3
A and B
A= $title eq "test_requires"B= $required_ref->{$module_name} =~ /mcpan/
ABresult
0X0
100
111
61  
62 0 my $sq_key = "\"$module_name\"";
63 printf "\t %-*s => \"%s\",\n", $pm_length + 2, $sq_key,
64 0 $required_ref->{$module_name};
65  
66 }
67 0 print "},\n";
68  
69 0 return;
70 }
71 #######
72 # footer_mb
73 #######
74 0 ▶sub footer_mb {
Subroutine footer_mb: not called CC=3 SCAR=24.8
Pod documented
75 0 my $self = shift;
76  
77 0 ▶ if (defined -d File::Spec->catdir($App::Midgen::Working_Dir, 'script')) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined -d 'File::Spec'->catdir($App::Midgen::Working_Dir, 'script')) { } 0 0 0
elsif (defined -d 'File::Spec'->catdir($App::Midgen::Working_Dir, 'bin')) { } 0 0 0
78 0 print "\n" . '"script_files" => [' . "\n";
79 0 print "\t\"script/...\"\n";
80 0 print "],\n";
81 }
82 elsif (defined -d File::Spec->catdir($App::Midgen::Working_Dir, 'bin')) {
83 0 print "\n" . '"script_files" => [' . "\n";
84 0 print "\t\"bin/...\"\n";
85 0 print "],\n";
86 }
87  
88 0 print "\n";
89  
90 0 return;
91 }
92  
93 2 ▶no Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
94  
95 2 1;
96  
97 __END__
« Midgen/Role/Output/Infile.pm ↑ Summary Midgen/Role/FindMinVersion.pm »