| 1 | package App::Midgen::Role::Output::CPANfile; | ||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use constant {NONE => q{}, THREE => 3,}; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use Moo::Role; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 6 | 2 | requires qw( verbose ); | |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||
| 8 | # Load time and dependencies negate execution time | ||||||||||||||||||||||||||||||
| 9 | # use namespace::clean -except => 'meta'; | ||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||
| 11 | 2 | our $VERSION = '0.34'; | |||||||||||||||||||||||||||||
| 12 | 2 | $VERSION = eval $VERSION; ## no critic | |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||
| 14 | 2 | ▶ | use English qw( -no_match_vars ); # Avoids reg-ex performance penalty | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 15 | 2 | local $OUTPUT_AUTOFLUSH = 1; | |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||
| 17 | 2 | ▶ | use Term::ANSIColor qw( :constants colored ); | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 18 | 2 | ▶ | use File::Spec; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||
| 20 | ####### | ||||||||||||||||||||||||||||||
| 21 | # header_cpanfile | ||||||||||||||||||||||||||||||
| 22 | ####### | ||||||||||||||||||||||||||||||
| 23 | 0 | ▶ | sub header_cpanfile { | ||||||||||||||||||||||||||||
|
Subroutine
header_cpanfile: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||
| 24 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 25 | 0 | ▶ | my $package_name = shift || NONE; | ||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | my $mi_ver = shift || NONE; | ||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||
| 28 | 0 | return; | |||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||
| 31 | ####### | ||||||||||||||||||||||||||||||
| 32 | # body_cpanfile | ||||||||||||||||||||||||||||||
| 33 | ####### | ||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | sub body_cpanfile { | ||||||||||||||||||||||||||||
|
Subroutine
body_cpanfile: not called CC=22 SCAR=62.3
Pod
documented
| |||||||||||||||||||||||||||||||
| 35 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 36 | 0 | ▶ | my $title = shift || return; | ||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | my $required_ref = shift || return; | ||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||
| 39 | 0 | my $pm_length = 0; | |||||||||||||||||||||||||||||
| 40 | 0 | foreach my $module_name (sort keys %{$required_ref}) { | |||||||||||||||||||||||||||||
| 41 | 0 | ▶ | if (length $module_name > $pm_length) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 42 | 0 | $pm_length = length $module_name; | |||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | if ($title eq 'RuntimeRequires') { | ||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||
| 47 | 0 | print "\n"; | |||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||
| 49 | 0 | $required_ref->{'perl'} = $App::Midgen::Min_Version; | |||||||||||||||||||||||||||||
| 50 | 0 | foreach my $module_name (sort keys %{$required_ref}) { | |||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||
| 52 | 0 | my $mod_name = "'$module_name',"; | |||||||||||||||||||||||||||||
| 53 | printf "%s %-*s '%s';\n", 'requires', $pm_length + THREE, $mod_name, | ||||||||||||||||||||||||||||||
| 54 | $required_ref->{$module_name} | ||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | if $required_ref->{$module_name} !~ m/mcpan/; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||
| 58 | elsif ($title eq 'RuntimeRecommends') { | ||||||||||||||||||||||||||||||
| 59 | 0 | print "\n"; | |||||||||||||||||||||||||||||
| 60 | 0 | foreach my $module_name (sort keys %{$required_ref}) { | |||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||
| 62 | 0 | my $mod_name = "'$module_name',"; | |||||||||||||||||||||||||||||
| 63 | printf "%s %-*s '%s';\n", 'recommends', $pm_length + THREE, $mod_name, | ||||||||||||||||||||||||||||||
| 64 | $required_ref->{$module_name} | ||||||||||||||||||||||||||||||
| 65 | 0 | ▶ | if $required_ref->{$module_name} !~ m/mcpan/; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||
| 68 | elsif ($title eq 'TestRequires') { | ||||||||||||||||||||||||||||||
| 69 | 0 | print "\non test => sub {\n"; | |||||||||||||||||||||||||||||
| 70 | 0 | foreach my $module_name (sort keys %{$required_ref}) { | |||||||||||||||||||||||||||||
| 71 | 0 | my $mod_name = "'$module_name',"; | |||||||||||||||||||||||||||||
| 72 | printf "\t%s %-*s '%s';\n", 'requires', $pm_length + THREE, $mod_name, | ||||||||||||||||||||||||||||||
| 73 | $required_ref->{$module_name} | ||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | if $required_ref->{$module_name} !~ m/mcpan/; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | print "\n" if %{$required_ref}; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||
| 79 | elsif ($title eq 'TestSuggests') { | ||||||||||||||||||||||||||||||
| 80 | 0 | foreach my $module_name (sort keys %{$required_ref}) { | |||||||||||||||||||||||||||||
| 81 | 0 | my $mod_name = "'$module_name',"; | |||||||||||||||||||||||||||||
| 82 | printf "\t%s %-*s '%s';\n", 'suggests', $pm_length + THREE, $mod_name, | ||||||||||||||||||||||||||||||
| 83 | $required_ref->{$module_name} | ||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | if $required_ref->{$module_name} !~ m/mcpan/; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||
| 88 | elsif ($title eq 'Close') { | ||||||||||||||||||||||||||||||
| 89 | 0 | print "};\n"; | |||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||
| 91 | elsif ($title eq 'DevelopRequires') { | ||||||||||||||||||||||||||||||
| 92 | 0 | print "\non develop => sub {\n"; | |||||||||||||||||||||||||||||
| 93 | 0 | foreach my $module_name (sort keys %{$required_ref}) { | |||||||||||||||||||||||||||||
| 94 | 0 | my $mod_name = "'$module_name',"; | |||||||||||||||||||||||||||||
| 95 | printf "\t%s %-*s '%s';\n", 'recommends', $pm_length + THREE, | ||||||||||||||||||||||||||||||
| 96 | $mod_name, $required_ref->{$module_name} | ||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | if $required_ref->{$module_name} !~ m/mcpan/; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||
| 100 | 0 | print "};\n"; | |||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||
| 103 | 0 | return; | |||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||
| 106 | ####### | ||||||||||||||||||||||||||||||
| 107 | # footer_cpanfile | ||||||||||||||||||||||||||||||
| 108 | ####### | ||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | sub footer_cpanfile { | ||||||||||||||||||||||||||||
|
Subroutine
footer_cpanfile: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 110 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 111 | 0 | ▶ | my $package_name = shift || NONE; | ||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||
| 112 | 0 | $package_name =~ s{::}{-}g; | |||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||
| 114 | 0 | print "\n"; | |||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||
| 116 | 0 | return; | |||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||
| 120 | 2 | ▶ | no Moo; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||
| 122 | 2 | 1; | |||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||
| 124 | __END__ | ||||||||||||||||||||||||||||||