| 1 | package App::Midgen::Role::Output::MIdsl; | ||||||||||||||||||||||||||||
| 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 | 2 | requires qw( no_index 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_dsl | ||||||||||||||||||||||||||||
| 22 | ####### | ||||||||||||||||||||||||||||
| 23 | 0 | ▶ | sub header_dsl { | ||||||||||||||||||||||||||
|
Subroutine
header_dsl: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 24 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 25 | 0 | ▶ | my $package_name = shift || NONE; # was shift // NONE -> defined $a ? $a : $b | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 26 | 0 | ▶ | my $mi_ver = shift || NONE; # defined shift ? shift : NONE - don't work as per perl5100delta.pod | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 0 | $package_name =~ s{::}{/}g; | |||||||||||||||||||||||||||
| 29 | 0 | print "\nuse strict;\n"; | |||||||||||||||||||||||||||
| 30 | 0 | print "use warnings;\n"; | |||||||||||||||||||||||||||
| 31 | 0 | print "use inc::Module::Install::DSL " | |||||||||||||||||||||||||||
| 32 | . colored($mi_ver, 'yellow') . ";\n"; | ||||||||||||||||||||||||||||
| 33 | 0 | ▶ | if ($package_name ne NONE) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 34 | 0 | print "all_from lib/$package_name.pm\n"; | |||||||||||||||||||||||||||
| 35 | 0 | print "requires_from lib/$package_name.pm\n"; | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 0 | print BRIGHT_BLACK . "license perl" . CLEAR . "\n"; | |||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 0 | return; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | ####### | ||||||||||||||||||||||||||||
| 43 | # body_dsl | ||||||||||||||||||||||||||||
| 44 | ####### | ||||||||||||||||||||||||||||
| 45 | 0 | ▶ | sub body_dsl { | ||||||||||||||||||||||||||
|
Subroutine
body_dsl: not called CC=12 SCAR=50.5
Pod
documented
| |||||||||||||||||||||||||||||
| 46 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 47 | 0 | my $title = shift; | |||||||||||||||||||||||||||
| 48 | 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()
| |||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 0 | ▶ | return if not %{$required_ref}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 0 | ▶ | print 'perl_version ' . $App::Midgen::Min_Version . "\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 53 | if $title eq 'RuntimeRequires'; | ||||||||||||||||||||||||||||
| 54 | 0 | print "\n"; | |||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 0 | my $pm_length = 0; | |||||||||||||||||||||||||||
| 57 | 0 | foreach my $module_name (sort keys %{$required_ref}) { | |||||||||||||||||||||||||||
| 58 | 0 | ▶ | if (length $module_name > $pm_length) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 59 | 0 | $pm_length = length $module_name; | |||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 0 | $title =~ s/^RuntimeRequires/requires/; | |||||||||||||||||||||||||||
| 64 | 0 | $title =~ s/^TestRequires/test_requires/; | |||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 0 | foreach my $module_name (sort keys %{$required_ref}) { | |||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | next | ||||||||||||||||||||||||||||
| 69 | if $title eq 'test_requires' | ||||||||||||||||||||||||||||
| 70 | 0 | ▶ | && $required_ref->{$module_name} =~ m/mcpan/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$title eq "test_requires" and $required_ref->{$module_name} =~ /mcpan/
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/
| |||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 0 | ▶ | if ($module_name =~ /^Win32/sxm) { | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 73 | printf "%s %-*s %s %s\n", $title, $pm_length, $module_name, | ||||||||||||||||||||||||||||
| 74 | 0 | $required_ref->{$module_name}, colored('if win32', 'bright_green'); | |||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | elsif ($module_name =~ /XS/sxm) { | ||||||||||||||||||||||||||||
| 77 | printf "%s %-*s %s %s\n", $title, $pm_length, $module_name, | ||||||||||||||||||||||||||||
| 78 | 0 | $required_ref->{$module_name}, colored('if can_xs', 'bright_blue'); | |||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||
| 80 | elsif ($module_name eq 'MRO::Compat') { | ||||||||||||||||||||||||||||
| 81 | printf "%s %-*s %s %s\n", $title, $pm_length, $module_name, | ||||||||||||||||||||||||||||
| 82 | 0 | $required_ref->{$module_name}, | |||||||||||||||||||||||||||
| 83 | colored('if $] < 5.009005', 'bright_blue'); | ||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||
| 85 | else { | ||||||||||||||||||||||||||||
| 86 | printf "%s %-*s %s\n", lc $title, $pm_length, $module_name, | ||||||||||||||||||||||||||||
| 87 | 0 | $required_ref->{$module_name}; | |||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||
| 90 | 0 | return; | |||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||
| 92 | ####### | ||||||||||||||||||||||||||||
| 93 | # footer_dsl | ||||||||||||||||||||||||||||
| 94 | ####### | ||||||||||||||||||||||||||||
| 95 | 0 | ▶ | sub footer_dsl { | ||||||||||||||||||||||||||
|
Subroutine
footer_dsl: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||
| 96 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 97 | 0 | ▶ | my $package_name = shift || NONE; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 98 | 0 | $package_name =~ s{::}{-}g; | |||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 0 | ▶ | if ($self->verbose > 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 101 | 0 | print BRIGHT_BLACK "\n"; | |||||||||||||||||||||||||||
| 102 | 0 | print "homepage https://github.com/.../$package_name\n"; | |||||||||||||||||||||||||||
| 103 | 0 | print "bugtracker https://github.com/.../$package_name/issues\n"; | |||||||||||||||||||||||||||
| 104 | 0 | print "repository git://github.com/.../$package_name.git\n"; | |||||||||||||||||||||||||||
| 105 | 0 | print CLEAR "\n"; | |||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||
| 107 | 0 | ▶ | if (defined -d File::Spec->catdir($App::Midgen::Working_Dir, 'share')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 108 | 0 | print "install_share\n\n"; | |||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | 0 | ▶ | if (defined -d File::Spec->catdir($App::Midgen::Working_Dir, 'script')) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 112 | 0 | print "install_script ...\n\n"; | |||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||
| 114 | elsif (defined -d File::Spec->catdir($App::Midgen::Working_Dir, 'bin')) { | ||||||||||||||||||||||||||||
| 115 | 0 | print "install_script bin/...\n\n"; | |||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | 0 | my @no_index = $self->no_index; | |||||||||||||||||||||||||||
| 119 | 0 | ▶ | if (@no_index) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 120 | 0 | print "no_index directory qw{ @no_index }\n\n"; | |||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | 0 | return; | |||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | 2 | ▶ | no Moo; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | 2 | 1; | |||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | __END__ | ||||||||||||||||||||||||||||