I've looked for answers for myself, not entirely successfully
I did some grep-ping through modules and found out where the message in question
is being generated. Lines 1496-1502 in CPAN.pm (near the end of the
file, in sub set_perl5lib):
my $cnt = keys %{$self->{is_tested}};
my $newenv = join $Config::Config{path_sep}, @dirs, @env;
$CPAN::Frontend->optprint('perl5lib', sprintf ("Prepending bli
+b/arch and blib/lib of ".
"%d build dirs to PERL5LIB, reaching
+size %d; ".
"for '%s'\n", $cnt, length($newenv),
+$for)
);
$ENV{PERL5LIB} = $newenv;
The code that stores the status of cached builds is this sub (line 1408):
#-> sub CPAN::is_tested
sub is_tested {
my($self,$what,$when) = @_;
unless ($what) {
Carp::cluck("DEBUG: empty what");
return;
}
$self->{is_tested}{$what} = $when;
}
The code that specifies what to do with the tested modules build dirs, is this:
sub _list_sorted_descending_is_tested {
my($self) = @_;
my $foul = 0;
my @sorted = sort
{ ($self->{is_tested}{$b}||0) <=> ($self->{is_tested}{$a}||0)
+}
grep
{ if ($foul){ 0 } elsif (-e) { 1 } else { $foul = $_;
+0 } }
keys %{$self->{is_tested}};
if ($foul) {
$CPAN::Frontend->mywarn("Lost build_dir detected ($foul), givi
+ng up all cached test results of currently running session.\n");
for my $dbd (sort keys %{$self->{is_tested}}) { # distro-build
+-dir
SEARCH: for my $d (sort { $a->id cmp $b->id } $CPAN::META->all
+_objects("CPAN::Distribution")) {
if ($d->{build_dir} && $d->{build_dir} eq $dbd) {
$CPAN::Frontend->mywarn(sprintf "Flushing cache fo
+r %s\n", $d->pretty_id);
$d->fforce("");
last SEARCH;
}
}
delete $self->{is_tested}{$dbd};
}
return ();
} else {
return @sorted;
}
}
Finally, the code that would clear the history of tested-but-not-installed modules
is this, but grep-ping through CPAN:: I find no place
where it's ever called:
#-> sub CPAN::reset_tested
# forget all distributions tested -- resets what gets included in PERL
+5LIB
sub reset_tested {
my ($self) = @_;
$self->{is_tested} = {};
}
I repeat for emphasis, this sub exists but I cannot locate anywhere that it is
called from! It would be nice if the CPAN shell had a
command to trigger this reset.
I have not failed to observe that a lot of perlers have switched allegiance from
CPAN.pm and CPANPLUS.pm to cpanm
(cpan minus/minimal). I still like being able to cope with the older implementations
of a CPAN utility, while at the same time I recognize
that cpanm has its strong points. So another pair of eyes (or more than
one) on this would be welcome! After all, CPAN.pm is the implementation that ships with Perl.
— Soren
Nov 25, 2025 at 18:32 UTC
|