| 1 | package App::Midgen::Role::Output::EUMM; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use constant { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | BLANK => q{ }, | |||||||||||||||||||||||||||
| 5 | NONE => q{}, | ||||||||||||||||||||||||||||
| 6 | THREE => q{ }, | ||||||||||||||||||||||||||||
| 7 | SIX => q{ }, | ||||||||||||||||||||||||||||
| 8 | NINE => q{ }, | ||||||||||||||||||||||||||||
| 9 | TWELVE => q{ }, | ||||||||||||||||||||||||||||
| 10 | 2 | }; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use Moo::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 2 | requires qw( verbose ); | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | # Load time and dependencies negate execution time | ||||||||||||||||||||||||||||
| 16 | # use namespace::clean -except => 'meta'; | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 2 | our $VERSION = '0.34'; | |||||||||||||||||||||||||||
| 19 | 2 | $VERSION = eval $VERSION; ## no critic | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 2 | ▶ | use English qw( -no_match_vars ); # Avoids reg-ex performance penalty | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 2 | local $OUTPUT_AUTOFLUSH = 1; | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 2 | ▶ | use Term::ANSIColor qw( :constants colored ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 25 | 2 | ▶ | use File::Spec; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | ####### | ||||||||||||||||||||||||||||
| 28 | # header_eumm | ||||||||||||||||||||||||||||
| 29 | ####### | ||||||||||||||||||||||||||||
| 30 | 0 | ▶ | sub header_eumm { | ||||||||||||||||||||||||||
|
Subroutine
header_eumm: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 31 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 32 | 0 | ▶ | my $package_name = shift || NONE; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | ▶ | if ($package_name ne NONE) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 0 | print "\nuse strict;\n"; | |||||||||||||||||||||||||||
| 37 | 0 | print "use warnings;\n"; | |||||||||||||||||||||||||||
| 38 | 0 | print "use ExtUtils::MakeMaker 6.68;\n\n"; | |||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 0 | print "WriteMakefile(\n"; | |||||||||||||||||||||||||||
| 41 | 0 | print THREE. "'NAME' => '$package_name',\n"; | |||||||||||||||||||||||||||
| 42 | 0 | $package_name =~ s{::}{/}g; | |||||||||||||||||||||||||||
| 43 | 0 | print THREE. "'VERSION_FROM' => 'lib/$package_name.pm',\n"; | |||||||||||||||||||||||||||
| 44 | 0 | print THREE. "'ABSTRACT_FROM' => 'lib/$package_name.pm',\n"; | |||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 0 | print BRIGHT_BLACK; | |||||||||||||||||||||||||||
| 47 | 0 | print THREE. "'AUTHOR' => '...',\n"; | |||||||||||||||||||||||||||
| 48 | 0 | print THREE. "'LICENSE' => 'perl',\n"; | |||||||||||||||||||||||||||
| 49 | 0 | print CLEAR; | |||||||||||||||||||||||||||
| 50 | ## 6.64 f***** RT#85406 | ||||||||||||||||||||||||||||
| 51 | 0 | print THREE. "'BUILD_REQUIRES' => {\n"; | |||||||||||||||||||||||||||
| 52 | 0 | print SIX. "'ExtUtils::MakeMaker' => '6.68',\n"; | |||||||||||||||||||||||||||
| 53 | 0 | print THREE. "},\n"; | |||||||||||||||||||||||||||
| 54 | 0 | print THREE. "'CONFIGURE_REQUIRES' => {\n"; | |||||||||||||||||||||||||||
| 55 | 0 | print SIX. "'ExtUtils::MakeMaker' => '6.68',\n"; | |||||||||||||||||||||||||||
| 56 | 0 | print THREE. "},\n"; | |||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 0 | return; | |||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | ####### | ||||||||||||||||||||||||||||
| 62 | # body_eumm | ||||||||||||||||||||||||||||
| 63 | ####### | ||||||||||||||||||||||||||||
| 64 | 0 | ▶ | sub body_eumm { | ||||||||||||||||||||||||||
|
Subroutine
body_eumm: not called CC=12 SCAR=50.5
Pod
documented
| |||||||||||||||||||||||||||||
| 65 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 66 | 0 | my $title = shift; | |||||||||||||||||||||||||||
| 67 | 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()
| |||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 0 | ▶ | return if not %{$required_ref}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 0 | my $pm_length = 0; | |||||||||||||||||||||||||||
| 72 | 0 | foreach my $module_name (sort keys %{$required_ref}) { | |||||||||||||||||||||||||||
| 73 | 0 | ▶ | if (length $module_name > $pm_length) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 74 | 0 | $pm_length = length $module_name; | |||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 0 | ▶ | print THREE. "'MIN_PERL_VERSION' => '$App::Midgen::Min_Version',\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 79 | if $title eq 'RuntimeRequires'; | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | # return if not %{$required_ref} and $title =~ m{(?:requires)\z}; | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | 0 | ▶ | if ($title eq 'RuntimeRequires') { | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 84 | 0 | print THREE. "'PREREQ_PM' => {\n"; | |||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||
| 86 | elsif ($title eq 'TestRequires') { | ||||||||||||||||||||||||||||
| 87 | 0 | print THREE. "'TEST_REQUIRES' => {\n"; | |||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||
| 89 | elsif ($title eq 'recommends') { | ||||||||||||||||||||||||||||
| 90 | 0 | $self->_recommends($required_ref); | |||||||||||||||||||||||||||
| 91 | 0 | return; | |||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | 0 | foreach my $module_name (sort keys %{$required_ref}) { | |||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | next | ||||||||||||||||||||||||||||
| 97 | if $title eq 'TestRequires' | ||||||||||||||||||||||||||||
| 98 | 0 | ▶ | && $required_ref->{$module_name} =~ m/mcpan/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$title eq "TestRequires" and $required_ref->{$module_name} =~ /mcpan/
MC/DC0%0/2
$title eq "TestRequires" and $required_ref->{$module_name} =~ /mcpan/
$title eq "TestRequires"
$required_ref->{$module_name} =~ /mcpan/
Truth table0%0/3
A and B
A= $title eq "TestRequires"B= $required_ref->{$module_name} =~ /mcpan/
| |||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 0 | my $sq_key = q{'} . $module_name . q{'}; | |||||||||||||||||||||||||||
| 101 | printf SIX. " %-*s => '%s',\n", $pm_length + 2, $sq_key, | ||||||||||||||||||||||||||||
| 102 | 0 | $required_ref->{$module_name}; | |||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||
| 104 | 0 | print THREE. "},\n"; | |||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | 0 | return; | |||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | 0 | ▶ | sub _recommends { | ||||||||||||||||||||||||||
|
Subroutine
_recommends: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 110 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 111 | 0 | my $required_ref = shift; | |||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | 0 | my $pm_length = 0; | |||||||||||||||||||||||||||
| 114 | 0 | foreach my $module_name (sort keys %{$required_ref}) { | |||||||||||||||||||||||||||
| 115 | 0 | ▶ | if (length $module_name > $pm_length) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 116 | 0 | $pm_length = length $module_name; | |||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||
| 119 | 0 | print THREE. "'META_MERGE' => {\n"; | |||||||||||||||||||||||||||
| 120 | 0 | print SIX. "'meta-spec' => { 'version' => '2' },\n"; | |||||||||||||||||||||||||||
| 121 | 0 | ▶ | return if not %{$required_ref}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 122 | 0 | print SIX. "'prereqs' => {\n"; | |||||||||||||||||||||||||||
| 123 | 0 | print NINE. "'test' => {\n"; | |||||||||||||||||||||||||||
| 124 | 0 | print TWELVE. "'suggests' => {\n"; | |||||||||||||||||||||||||||
| 125 | 0 | foreach my $module_name (sort keys %{$required_ref}) { | |||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | 0 | my $sq_key = q{'} . $module_name . q{'}; | |||||||||||||||||||||||||||
| 128 | printf "%-15s %-*s => '%s',\n", BLANK, $pm_length + 2, $sq_key, | ||||||||||||||||||||||||||||
| 129 | 0 | $required_ref->{$module_name}; | |||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||
| 131 | 0 | print TWELVE. "}\n"; | |||||||||||||||||||||||||||
| 132 | 0 | print NINE. "}\n"; | |||||||||||||||||||||||||||
| 133 | 0 | print SIX. "},\n"; | |||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | ####### | ||||||||||||||||||||||||||||
| 139 | # footer_eumm | ||||||||||||||||||||||||||||
| 140 | ####### | ||||||||||||||||||||||||||||
| 141 | 0 | ▶ | sub footer_eumm { | ||||||||||||||||||||||||||
|
Subroutine
footer_eumm: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 142 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 143 | 0 | ▶ | my $package_name = shift || NONE; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 144 | 0 | $package_name =~ s{::}{-}g; | |||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | 0 | ▶ | if ($self->verbose > 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 147 | 0 | print BRIGHT_BLACK; | |||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | 0 | print SIX. "'resources' => {\n"; | |||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | 0 | print NINE. "'bugtracker' => {\n"; | |||||||||||||||||||||||||||
| 152 | 0 | print TWELVE. "'web' => 'https://github.com/.../$package_name/issues',\n"; | |||||||||||||||||||||||||||
| 153 | 0 | print NINE. "},\n"; | |||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | 0 | print NINE. "'homepage' => 'https://github.com/.../$package_name',\n"; | |||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||
| 157 | 0 | print NINE. "'repository' => {\n"; | |||||||||||||||||||||||||||
| 158 | 0 | print TWELVE. "'type' => 'git',\n"; | |||||||||||||||||||||||||||
| 159 | 0 | print TWELVE. "'url' => 'git://github.com/.../$package_name.git',\n"; | |||||||||||||||||||||||||||
| 160 | 0 | print TWELVE. "'web' => 'https://github.com/.../$package_name',\n"; | |||||||||||||||||||||||||||
| 161 | 0 | print NINE. "},\n"; | |||||||||||||||||||||||||||
| 162 | 0 | print SIX. "},\n"; | |||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | 0 | print SIX. "'x_contributors' => [\n"; | |||||||||||||||||||||||||||
| 165 | 0 | print NINE. "'brian d foy (ADOPTME) <brian.d.foy\@gmail.com>',\n"; | |||||||||||||||||||||||||||
| 166 | 0 | print NINE. "'Fred Bloggs <fred\@bloggs.org>',\n"; | |||||||||||||||||||||||||||
| 167 | 0 | print SIX. "],\n"; | |||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | 0 | print CLEAR; | |||||||||||||||||||||||||||
| 170 | 0 | print THREE. "},\n"; | |||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | 0 | ▶ | if (defined -d File::Spec->catdir($App::Midgen::Working_Dir, 'script')) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 175 | 0 | print THREE. "'EXE_FILES' => [ (\n"; | |||||||||||||||||||||||||||
| 176 | 0 | print SIX. "'script/...'\n"; | |||||||||||||||||||||||||||
| 177 | 0 | print THREE. ") ],\n"; | |||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||
| 179 | elsif (defined -d File::Spec->catdir($App::Midgen::Working_Dir, 'bin')) { | ||||||||||||||||||||||||||||
| 180 | 0 | print THREE. "'EXE_FILES' => [qw(\n"; | |||||||||||||||||||||||||||
| 181 | 0 | print SIX. "bin/...\n"; | |||||||||||||||||||||||||||
| 182 | 0 | print THREE. ")],\n"; | |||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||
| 185 | 0 | print ")\n\n"; | |||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | 0 | return; | |||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | 2 | ▶ | no Moo; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | 2 | 1; | |||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | __END__ | ||||||||||||||||||||||||||||