| 1 | package CPAN::Maker::Bootstrapper::Role::DistImporter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use Archive::Tar; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 3 | ▶ | use CPAN::Meta; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 3 | ▶ | use Cwd qw(abs_path); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 3 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 3 | ▶ | use English qw(-no_match_vars); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 3 | ▶ | use File::Basename qw(basename); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 3 | ▶ | use File::Spec; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 3 | ▶ | use File::Temp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 3 | ▶ | use Role::Tiny; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 3 | our $VERSION = '2.6.2'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 2 | ▶ | sub cmd_import_dist { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cmd_import_dist: called CC=6 SCAR=18.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 2 | my ($source) = $self->get_args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 2 | ▶ | die "usage: import-dist distribution.tar.gz|directory\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $source or $source eq ""
MC/DC0%0/2
not defined $source or $source eq ""
not defined $source
$source eq ""
Truth table33%1/3
not(A) or B
A= not defined $sourceB= $source eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | if !defined $source || $source eq q{}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 2 | my $plan = $self->_inspect_distribution($source); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 2 | print $self->_format_distribution_plan($plan); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 2 | ▶ | return 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | if $self->get_dry_run; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 1 | my $module_name = $plan->{distribution}{name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 1 | $module_name =~ s/-/::/gxsm; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | die sprintf "ERROR: distribution name '%s' cannot be represented as a module name\n", $plan->{distribution}{name} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 1 | ▶ | if $module_name !~ /\A[[:alpha:]]\w*(?:::[[:alpha:]]\w*)*\z/xsm; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 1 | my @sources = grep { $_->{action} eq 'import' } @{ $plan->{files} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 1 | ▶ | die "ERROR: no importable source files found\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | if !@sources; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 1 | my $root = $plan->{distribution}{root}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | my $listing = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | files => \@sources, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | packages => $plan->{packages}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 1 | $self->set_import_file_listing($listing); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 1 | local $ENV{SYNTAX_CHECKING} = 'off'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | my $status = $self->_import_project( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | module => $module_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | stub => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | import_paths => [$root], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | post_build => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | my ($directory) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | print $self->_compare_distribution_dependencies( $plan, $directory ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 1 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 1 | return $status; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 4 | ▶ | sub _inspect_distribution { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_inspect_distribution: called CC=46 SCAR=46.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 4 | my ( $self, $source ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 4 | ▶ | die "ERROR: distribution input not found: $source\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | if !-e $source; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 4 | my $root; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | my $extraction_guard; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 4 | ▶ | if ( -d $source ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 2 | $root = abs_path($source); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | # Retain the extraction directory until this inspection completes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 2 | $extraction_guard = File::Temp->newdir( CLEANUP => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 2 | my $tmpdir = "$extraction_guard"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 2 | my $archive = Archive::Tar->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 2 | ▶ | die "ERROR: could not read archive: $source\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | if !$archive->read($source); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 2 | my @members = $archive->get_files; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 2 | my %top; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 2 | for my $member (@members) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 16 | my $path = $member->full_path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 16 | ▶ | die "ERROR: unsafe archive member: $path\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$path =~ m[\A/] or $path =~ m[(?:\A|/)\.\.(?:/|\z)] or $path =~ /\\/ or $path =~ /\A\.\z/
$path =~ m[\A/] or $path =~ m[(?:\A|/)\.\.(?:/|\z)] or $path =~ /\\/
$path =~ m[\A/] or $path =~ m[(?:\A|/)\.\.(?:/|\z)]
MC/DC0%0/4
$path =~ m[\A/] or $path =~ m[(?:\A|/)\.\.(?:/|\z)] or $path =~ /\\/ or $path =~ /\A\.\z/
$path =~ m[\A/]
$path =~ m[(?:\A|/)\.\.(?:/|\z)]
$path =~ /\\/
$path =~ /\A\.\z/
Truth table20%1/5
A or B or C or D
A= $path =~ m[\A/]B= $path =~ m[(?:\A|/)\.\.(?:/|\z)]C= $path =~ /\\/D= $path =~ /\A\.\z/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | if $path =~ m{\A/} || $path =~ m{(?:\A|/)\.\.(?:/|\z)} || $path =~ m{\\} || $path =~ m{\A\.\z}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 16 | ▶ | die "ERROR: archive member type not supported: $path\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$member->is_file or $member->is_dir
MC/DC0%0/2
$member->is_file or $member->is_dir
$member->is_file
$member->is_dir
Truth table66%2/3
A or B
A= $member->is_fileB= $member->is_dir
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | if !$member->is_file && !$member->is_dir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 16 | my ($first) = split m{/}, $path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 16 | $top{$first} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 2 | ▶ | die "ERROR: archive must contain one distribution directory\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | if keys(%top) != 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 2 | my ($directory) = keys %top; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | die "ERROR: archive must have a top-level directory\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 2 | ▶ | if !grep { $_->full_path =~ m{\A\Q$directory\E/} } @members; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 2 | my $cwd = Cwd::getcwd(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 2 | ▶ | chdir $tmpdir or die "ERROR: chdir $tmpdir: $OS_ERROR\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 2 | my $ok = $archive->extract; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 2 | ▶ | chdir $cwd or die "ERROR: chdir $cwd: $OS_ERROR\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 2 | ▶ | die "ERROR: extraction failed: $source\n" if !$ok; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 2 | $root = File::Spec->catdir( $tmpdir, $directory ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 2 | ▶ | die "ERROR: extracted distribution directory missing\n" if !-d $root; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 4 | my $metadata_path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 4 | for my $candidate (qw(META.json META.yml)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 4 | my $path = File::Spec->catfile( $root, $candidate ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 4 | ▶ | if ( -f $path ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 4 | $metadata_path = $path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 4 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 4 | ▶ | die "ERROR: distribution has no META.json or META.yml\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | if !$metadata_path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 4 | my $meta = CPAN::Meta->load_file($metadata_path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 4 | my $manifest = File::Spec->catfile( $root, 'MANIFEST' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 4 | ▶ | die "ERROR: distribution has no MANIFEST\n" if !-f $manifest; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 4 | ▶ | open my $fh, '<', $manifest or die "ERROR: cannot read MANIFEST: $OS_ERROR\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 4 | my @files; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | my @warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 4 | my %seen; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 4 | ▶ | while ( my $line = <$fh> ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 16 | $line =~ s/\r?\n\z//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 16 | ▶ | next if $line eq q{} || $line =~ /\A#/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$line eq "" or $line =~ /\A#/
MC/DC0%0/2
$line eq "" or $line =~ /\A#/
$line eq ""
$line =~ /\A#/
Truth table33%1/3
A or B
A= $line eq ""B= $line =~ /\A#/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 16 | my ($path) = split /\s+/, $line, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 16 | ▶ | die "ERROR: unsafe MANIFEST entry: $path\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$path =~ m[\A/] or $path =~ m[(?:\A|/)\.\.(?:/|\z)] or $path =~ /\\/
$path =~ m[\A/] or $path =~ m[(?:\A|/)\.\.(?:/|\z)]
MC/DC0%0/3
$path =~ m[\A/] or $path =~ m[(?:\A|/)\.\.(?:/|\z)] or $path =~ /\\/
$path =~ m[\A/]
$path =~ m[(?:\A|/)\.\.(?:/|\z)]
$path =~ /\\/
Truth table25%1/4
A or B or C
A= $path =~ m[\A/]B= $path =~ m[(?:\A|/)\.\.(?:/|\z)]C= $path =~ /\\/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | if $path =~ m{\A/} || $path =~ m{(?:\A|/)\.\.(?:/|\z)} || $path =~ m{\\}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 16 | ▶ | next if $seen{$path}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 16 | my $full = File::Spec->catfile( $root, split m{/}, $path ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 16 | my $resolved = abs_path($full); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 16 | ▶ | if (!-f $full | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
not -f $full or -l $full or not defined $resolved or index($resolved, "$root/") != 0
not -f $full or -l $full or not defined $resolved
not -f $full or -l $full
MC/DC0%0/4
not -f $full or -l $full or not defined $resolved or index($resolved, "$root/") != 0
not -f $full
-l $full
not defined $resolved
index($resolved, "$root/") != 0
Truth table20%1/5
not(A) or B or not(C) or D
A= not -f $fullB= -l $fullC= not defined $resolvedD= index($resolved, "$root/") != 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | || -l $full | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | || !defined $resolved | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | || index( $resolved, "$root/" ) != 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | push @warnings, "missing or unsupported MANIFEST file: $path"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 16 | my $class = 'resource'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 16 | ▶ | $class = 'module' if $path =~ m{\Alib/.*\.pm\z}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 16 | ▶ | $class = 'test' if $path =~ m{\A(?:t|xt)/}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 16 | ▶ | $class = 'script' if $path =~ m{\A(?:bin|script)/}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 16 | ▶ | $class = 'metadata' if $path =~ m{\A(?:META\.(?:json|yml)|MANIFEST(?:\.SKIP)?|Makefile\.PL|Build\.PL)\z}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 16 | my $destination = $path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 16 | ▶ | if ( $class ne 'test' && $class ne 'metadata' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$class ne "test" and $class ne "metadata"
MC/DC100%2/2
$class ne "test" and $class ne "metadata"
$class ne "test"
$class ne "metadata"
Truth table100%3/3
A and B
A= $class ne "test"B= $class ne "metadata"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 4 | ▶ | if ( $path =~ /[.](?:pm|pl|sh)\z/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition16%1/6
$path =~ /[.](?:pm|pl|sh)\z/ or -x $full and not $path =~ m[[.][^/]+\z]
-x $full and not $path =~ m[[.][^/]+\z]
MC/DC0%0/3
$path =~ /[.](?:pm|pl|sh)\z/ or -x $full and not $path =~ m[[.][^/]+\z]
$path =~ /[.](?:pm|pl|sh)\z/
-x $full
not $path =~ m[[.][^/]+\z]
Truth table25%1/4
A or B and not(C)
A= $path =~ /[.](?:pm|pl|sh)\z/B= -x $fullC= not $path =~ m[[.][^/]+\z]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | || ( -x $full && $path !~ /[.][^\/]+\z/ ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 4 | ▶ | $class = 'script' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$class eq "resource" and not $path =~ /[.]pm\z/
MC/DC0%0/2
$class eq "resource" and not $path =~ /[.]pm\z/
$class eq "resource"
not $path =~ /[.]pm\z/
Truth table33%1/3
A and not(B)
A= $class eq "resource"B= not $path =~ /[.]pm\z/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | if $class eq 'resource' && $path !~ /[.]pm\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 4 | $destination .= '.in'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 16 | ▶ | push @files, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | class => $class, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | source => $full, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | destination => $destination, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | import_root => $root, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | action => $class eq 'metadata' ? 'translate-or-review' : 'import', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 4 | ▶ | close $fh or die "ERROR: closing MANIFEST: $OS_ERROR\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 4 | my $prerequisites = $meta->effective_prereqs->as_string_hash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 4 | my ( $dependency_files, $dependency_warnings ) = $self->_map_distribution_prerequisites($prerequisites); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 4 | push @warnings, @{$dependency_warnings}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 4 | dependency_files => $dependency_files, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | distribution => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | name => $meta->name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | version => $meta->version, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | abstract => $meta->abstract, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | root => $root, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | files => \@files, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | packages => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | prerequisites => $prerequisites, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | warnings => \@warnings, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | _extraction_guard => $extraction_guard, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 5 | ▶ | sub _map_distribution_prerequisites { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_map_distribution_prerequisites: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 5 | my ( $self, $prerequisites ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 5 | my %files = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | requires => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 'test-requires' => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | recommends => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | suggests => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 5 | my @warnings; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 5 | my %mapping = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | runtime => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | requires => 'requires', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | recommends => 'recommends', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | suggests => 'suggests', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | test => { requires => 'test-requires' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 5 | for my $phase ( sort keys %{$prerequisites} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 8 | for my $relationship ( sort keys %{ $prerequisites->{$phase} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 11 | my $dependencies = $prerequisites->{$phase}{$relationship}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 11 | my $target = $mapping{$phase}{$relationship}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 11 | ▶ | if ( !$target ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 3 | push @warnings, sprintf 'unsupported CPAN prerequisite category %s.%s; preserving in inspection plan', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | $phase, $relationship; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 3 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 8 | for my $module ( sort keys %{$dependencies} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 8 | $files{$target}{$module} = $dependencies->{$module}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 5 | return ( \%files, \@warnings ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 12 | ▶ | sub _read_generated_dependencies { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_read_generated_dependencies: called CC=7 SCAR=19.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 12 | my ( $self, $directory, $filename ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 12 | my $path = File::Spec->catfile( $directory, $filename ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 12 | ▶ | return ( undef, sprintf 'missing generated manifest: %s', $filename ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | if !-f $path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 11 | ▶ | open my $fh, '<', $path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | or return ( undef, sprintf 'cannot read %s: %s', $filename, $OS_ERROR ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 11 | my %dependencies; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 11 | ▶ | while ( my $line = <$fh> ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 7 | $line =~ s/\r?\n\z//xsm; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 7 | ▶ | next if $line =~ /\A\s*(?:[#]|\z)/xsm; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 7 | ▶ | if ( $line !~ /\A\s*[+]?([A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_][A-Za-z_0-9]*)*)\s+(.+?)\s*\z/xsm ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 1 | close $fh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 1 | return ( undef, sprintf 'unrecognized dependency entry in %s: %s', $filename, $line ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 6 | $dependencies{$1} = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 10 | ▶ | close $fh | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | or return ( undef, sprintf 'error closing %s: %s', $filename, $OS_ERROR ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 10 | return ( \%dependencies, undef ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 3 | ▶ | sub _compare_distribution_dependencies { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_compare_distribution_dependencies: called CC=11 SCAR=24.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 3 | my ( $self, $plan, $directory ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 3 | my @lines = ('Dependency comparison (CMB manifests vs CPAN metadata):'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 3 | my $incomplete = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 3 | for my $filename (qw(requires test-requires recommends suggests)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 12 | my ( $actual, $error ) = $self->_read_generated_dependencies( $directory, $filename ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 12 | push @lines, sprintf ' %s:', $filename; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 12 | ▶ | if ($error) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 2 | push @lines, sprintf ' INCOMPLETE: %s', $error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 2 | $incomplete = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 2 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 10 | ▶ | my $declared = $plan->{dependency_files}{$filename} // {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$plan->{"dependency_files"}{$filename} // {}
MC/DC0%0/1
$plan->{"dependency_files"}{$filename} // {}
$plan->{"dependency_files"}{$filename}
Truth table50%1/2
A
A= $plan->{"dependency_files"}{$filename}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 10 | my @differences; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 10 | for my $module ( sort keys %{$actual} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 6 | ▶ | if ( !exists $declared->{$module} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 3 | push @differences, sprintf ' + %s %s', $module, $actual->{$module}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | elsif ( $actual->{$module} ne $declared->{$module} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 3 | push @differences, sprintf ' ~ %s: CPAN %s; CMB %s', $module, $declared->{$module}, $actual->{$module}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 10 | for my $module ( sort keys %{$declared} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 6 | ▶ | if ( !exists $actual->{$module} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 3 | push @differences, sprintf ' - %s %s', $module, $declared->{$module}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 10 | ▶ | push @lines, @differences ? @differences : ' No discrepancies'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 3 | push @lines, ' + CMB only; - CPAN only; ~ different version requirement'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 3 | push @lines, ' Findings are informational; inspect dynamic dependencies and version constraints.'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 3 | ▶ | push @lines, ' Comparison incomplete: some generated manifests could not be read.' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | if $incomplete; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 3 | return join( "\n", @lines ) . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 2 | ▶ | sub _format_distribution_plan { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_format_distribution_plan: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 2 | my ( $self, $plan ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 2 | my $dist = $plan->{distribution}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 2 | my @lines = ( sprintf 'Distribution: %s %s', $dist->{name}, $dist->{version} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 2 | for my $file ( @{ $plan->{files} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | push @lines, sprintf '%s [%s] %s -> %s', $file->{action}, $file->{class}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 8 | File::Spec->abs2rel( $file->{source}, $dist->{root} ), $file->{destination}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 2 | for my $warning ( @{ $plan->{warnings} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | push @lines, "WARNING: $warning"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 2 | push @lines, 'Dependency file mapping (inspection only; not persisted):'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 2 | for my $filename (qw(requires test-requires recommends suggests)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 8 | for my $module ( sort keys %{ $plan->{dependency_files}{$filename} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 2 | push @lines, sprintf '%s: %s %s', $filename, $module, $plan->{dependency_files}{$filename}{$module}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 2 | push @lines, 'Prerequisites:', Data::Dumper->new( [ $plan->{prerequisites} ] )->Sortkeys(1)->Terse(1)->Dump; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 2 | return join( "\n", @lines ) . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||