Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions lib/CPAN/Mini/Inject.pm
Original file line number Diff line number Diff line change
Expand Up @@ -403,12 +403,17 @@ sub inject {

my %updatedir;
my %already_injected;
my %report;
for my $modline ( @{ $self->{modulelist} } ) {
my ( $module, $version, $file ) = split( /\s+/, $modline );

next if $already_injected{$file}++;

my $target = $self->config->get( 'local' ) . '/authors/id/' . $file;

# collect all modules of a target/file
# needed for report
push @{ $report{$target} }, $module;
next if $already_injected{$module}++;

my $source
= $self->config->get( 'repository' ) . '/authors/id/' . $file;

Expand All @@ -420,7 +425,19 @@ sub inject {
or croak "Copy $source to $tdir failed: $!";

$self->_updperms( $target );
print "$target ... injected $module\n" if $verbose;
}

# if verbose report target file and the modules it contains
if ( $verbose ) {
for my $target (keys %report) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the keys should be sorted? That would make reading the report easier. Since we cannot have them in the order they were done, we can at least have them in some order, rather than random.

my $target_str = "$target ... injected modules : ";
my $fmt = '%' . length($target_str) . "s%s\n";
my @modules = @{ $report{$target} };
printf $fmt, $target_str, shift @modules; # first line with target
for my $module ( @modules ) { # rest only the module
printf $fmt, '', $module;
}
}
}

for my $dir ( keys( %updatedir ) ) {
Expand Down