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


In reply to Re: What is cpan (the installer) doing prepending all these directories to the PERL5LIB path? by Intrepid
in thread What is cpan (the installer) doing prepending all these directories to the PERL5LIB path? by Intrepid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.