<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package CPAN::Shell;
use strict;

# -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*-
# vim: ts=4 sts=4 sw=4:

use vars qw(
            $ADVANCED_QUERY
            $AUTOLOAD
            $COLOR_REGISTERED
            $Help
            $autoload_recursion
            $reload
            @ISA
            @relo
            $VERSION
           );
@relo =     (
             "CPAN.pm",
             "CPAN/Author.pm",
             "CPAN/CacheMgr.pm",
             "CPAN/Complete.pm",
             "CPAN/Debug.pm",
             "CPAN/DeferredCode.pm",
             "CPAN/Distribution.pm",
             "CPAN/Distroprefs.pm",
             "CPAN/Distrostatus.pm",
             "CPAN/Exception/RecursiveDependency.pm",
             "CPAN/Exception/yaml_not_installed.pm",
             "CPAN/FirstTime.pm",
             "CPAN/FTP.pm",
             "CPAN/FTP/netrc.pm",
             "CPAN/HandleConfig.pm",
             "CPAN/Index.pm",
             "CPAN/InfoObj.pm",
             "CPAN/Kwalify.pm",
             "CPAN/LWP/UserAgent.pm",
             "CPAN/Module.pm",
             "CPAN/Prompt.pm",
             "CPAN/Queue.pm",
             "CPAN/Reporter/Config.pm",
             "CPAN/Reporter/History.pm",
             "CPAN/Reporter/PrereqCheck.pm",
             "CPAN/Reporter.pm",
             "CPAN/Shell.pm",
             "CPAN/SQLite.pm",
             "CPAN/Tarzip.pm",
             "CPAN/Version.pm",
            );
$VERSION = "5.5002";
# record the initial timestamp for reload.
$reload = { map {$INC{$_} ? ($_,(stat $INC{$_})[9]) : ()} @relo };
@CPAN::Shell::ISA = qw(CPAN::Debug);
use Cwd qw(chdir);
use Carp ();
$COLOR_REGISTERED ||= 0;
$Help = {
         '?' =&gt; \"help",
         '!' =&gt; "eval the rest of the line as perl",
         a =&gt; "whois author",
         autobundle =&gt; "write inventory into a bundle file",
         b =&gt; "info about bundle",
         bye =&gt; \"quit",
         clean =&gt; "clean up a distribution's build directory",
         # cvs_import
         d =&gt; "info about a distribution",
         # dump
         exit =&gt; \"quit",
         failed =&gt; "list all failed actions within current session",
         fforce =&gt; "redo a command from scratch",
         force =&gt; "redo a command",
         get =&gt; "download a distribution",
         h =&gt; \"help",
         help =&gt; "overview over commands; 'help ...' explains specific commands",
         hosts =&gt; "statistics about recently used hosts",
         i =&gt; "info about authors/bundles/distributions/modules",
         install =&gt; "install a distribution",
         install_tested =&gt; "install all distributions tested OK",
         is_tested =&gt; "list all distributions tested OK",
         look =&gt; "open a subshell in a distribution's directory",
         ls =&gt; "list distributions matching a fileglob",
         m =&gt; "info about a module",
         make =&gt; "make/build a distribution",
         mkmyconfig =&gt; "write current config into a CPAN/MyConfig.pm file",
         notest =&gt; "run a (usually install) command but leave out the test phase",
         o =&gt; "'o conf ...' for config stuff; 'o debug ...' for debugging",
         perldoc =&gt; "try to get a manpage for a module",
         q =&gt; \"quit",
         quit =&gt; "leave the cpan shell",
         r =&gt; "review upgradable modules",
         readme =&gt; "display the README of a distro with a pager",
         recent =&gt; "show recent uploads to the CPAN",
         # recompile
         reload =&gt; "'reload cpan' or 'reload index'",
         report =&gt; "test a distribution and send a test report to cpantesters",
         reports =&gt; "info about reported tests from cpantesters",
         # scripts
         # smoke
         test =&gt; "test a distribution",
         u =&gt; "display uninstalled modules",
         upgrade =&gt; "combine 'r' command with immediate installation",
        };
{
    $autoload_recursion   ||= 0;

    #-&gt; sub CPAN::Shell::AUTOLOAD ;
    sub AUTOLOAD { ## no critic
        $autoload_recursion++;
        my($l) = $AUTOLOAD;
        my $class = shift(@_);
        # warn "autoload[$l] class[$class]";
        $l =~ s/.*:://;
        if ($CPAN::Signal) {
            warn "Refusing to autoload '$l' while signal pending";
            $autoload_recursion--;
            return;
        }
        if ($autoload_recursion &gt; 1) {
            my $fullcommand = join " ", map { "'$_'" } $l, @_;
            warn "Refusing to autoload $fullcommand in recursion\n";
            $autoload_recursion--;
            return;
        }
        if ($l =~ /^w/) {
            # XXX needs to be reconsidered
            if ($CPAN::META-&gt;has_inst('CPAN::WAIT')) {
                CPAN::WAIT-&gt;$l(@_);
            } else {
                $CPAN::Frontend-&gt;mywarn(qq{
Commands starting with "w" require CPAN::WAIT to be installed.
Please consider installing CPAN::WAIT to use the fulltext index.
For this you just need to type
    install CPAN::WAIT
});
            }
        } else {
            $CPAN::Frontend-&gt;mywarn(qq{Unknown shell command '$l'. }.
                                    qq{Type ? for help.
});
        }
        $autoload_recursion--;
    }
}


#-&gt; sub CPAN::Shell::h ;
sub h {
    my($class,$about) = @_;
    if (defined $about) {
        my $help;
        if (exists $Help-&gt;{$about}) {
            if (ref $Help-&gt;{$about}) { # aliases
                $about = ${$Help-&gt;{$about}};
            }
            $help = $Help-&gt;{$about};
        } else {
            $help = "No help available";
        }
        $CPAN::Frontend-&gt;myprint("$about\: $help\n");
    } else {
        my $filler = " " x (80 - 28 - length($CPAN::VERSION));
        $CPAN::Frontend-&gt;myprint(qq{
Display Information $filler (ver $CPAN::VERSION)
 command  argument          description
 a,b,d,m  WORD or /REGEXP/  about authors, bundles, distributions, modules
 i        WORD or /REGEXP/  about any of the above
 ls       AUTHOR or GLOB    about files in the author's directory
    (with WORD being a module, bundle or author name or a distribution
    name of the form AUTHOR/DISTRIBUTION)

Download, Test, Make, Install...
 get      download                     clean    make clean
 make     make (implies get)           look     open subshell in dist directory
 test     make test (implies make)     readme   display these README files
 install  make install (implies test)  perldoc  display POD documentation

Upgrade
 r        WORDs or /REGEXP/ or NONE    report updates for some/matching/all modules
 upgrade  WORDs or /REGEXP/ or NONE    upgrade some/matching/all modules

Pragmas
 force  CMD    try hard to do command  fforce CMD    try harder
 notest CMD    skip testing

Other
 h,?           display this menu       ! perl-code   eval a perl command
 o conf [opt]  set and query options   q             quit the cpan shell
 reload cpan   load CPAN.pm again      reload index  load newer indices
 autobundle    Snapshot                recent        latest CPAN uploads});
}
}

*help = \&amp;h;

#-&gt; sub CPAN::Shell::a ;
sub a {
  my($self,@arg) = @_;
  # authors are always UPPERCASE
  for (@arg) {
    $_ = uc $_ unless /=/;
  }
  $CPAN::Frontend-&gt;myprint($self-&gt;format_result('Author',@arg));
}

#-&gt; sub CPAN::Shell::globls ;
sub globls {
    my($self,$s,$pragmas) = @_;
    # ls is really very different, but we had it once as an ordinary
    # command in the Shell (upto rev. 321) and we could not handle
    # force well then
    my(@accept,@preexpand);
    if ($s =~ /[\*\?\/]/) {
        if ($CPAN::META-&gt;has_inst("Text::Glob")) {
            if (my($au,$pathglob) = $s =~ m|(.*?)/(.*)|) {
                my $rau = Text::Glob::glob_to_regex(uc $au);
                CPAN::Shell-&gt;debug("au[$au]pathglob[$pathglob]rau[$rau]")
                      if $CPAN::DEBUG;
                push @preexpand, map { $_-&gt;id . "/" . $pathglob }
                    CPAN::Shell-&gt;expand_by_method('CPAN::Author',['id'],"/$rau/");
            } else {
                my $rau = Text::Glob::glob_to_regex(uc $s);
                push @preexpand, map { $_-&gt;id }
                    CPAN::Shell-&gt;expand_by_method('CPAN::Author',
                                                  ['id'],
                                                  "/$rau/");
            }
        } else {
            $CPAN::Frontend-&gt;mydie("Text::Glob not installed, cannot proceed");
        }
    } else {
        push @preexpand, uc $s;
    }
    for (@preexpand) {
        unless (/^[A-Z0-9\-]+(\/|$)/i) {
            $CPAN::Frontend-&gt;mywarn("ls command rejects argument $_: not an author\n");
            next;
        }
        push @accept, $_;
    }
    my $silent = @accept&gt;1;
    my $last_alpha = "";
    my @results;
    for my $a (@accept) {
        my($author,$pathglob);
        if ($a =~ m|(.*?)/(.*)|) {
            my $a2 = $1;
            $pathglob = $2;
            $author = CPAN::Shell-&gt;expand_by_method('CPAN::Author',
                                                    ['id'],
                                                    $a2)
                or $CPAN::Frontend-&gt;mydie("No author found for $a2\n");
        } else {
            $author = CPAN::Shell-&gt;expand_by_method('CPAN::Author',
                                                    ['id'],
                                                    $a)
                or $CPAN::Frontend-&gt;mydie("No author found for $a\n");
        }
        if ($silent) {
            my $alpha = substr $author-&gt;id, 0, 1;
            my $ad;
            if ($alpha eq $last_alpha) {
                $ad = "";
            } else {
                $ad = "[$alpha]";
                $last_alpha = $alpha;
            }
            $CPAN::Frontend-&gt;myprint($ad);
        }
        for my $pragma (@$pragmas) {
            if ($author-&gt;can($pragma)) {
                $author-&gt;$pragma();
            }
        }
        CPAN-&gt;debug("author[$author]pathglob[$pathglob]silent[$silent]") if $CPAN::DEBUG;
        push @results, $author-&gt;ls($pathglob,$silent); # silent if
                                                       # more than one
                                                       # author
        for my $pragma (@$pragmas) {
            my $unpragma = "un$pragma";
            if ($author-&gt;can($unpragma)) {
                $author-&gt;$unpragma();
            }
        }
    }
    @results;
}

#-&gt; sub CPAN::Shell::local_bundles ;
sub local_bundles {
    my($self,@which) = @_;
    my($incdir,$bdir,$dh);
    foreach $incdir ($CPAN::Config-&gt;{'cpan_home'},@INC) {
        my @bbase = "Bundle";
        while (my $bbase = shift @bbase) {
            $bdir = File::Spec-&gt;catdir($incdir,split /::/, $bbase);
            CPAN-&gt;debug("bdir[$bdir]\@bbase[@bbase]") if $CPAN::DEBUG;
            if ($dh = DirHandle-&gt;new($bdir)) { # may fail
                my($entry);
                for $entry ($dh-&gt;read) {
                    next if $entry =~ /^\./;
                    next unless $entry =~ /^\w+(\.pm)?(?!\n)\Z/;
                    if (-d File::Spec-&gt;catdir($bdir,$entry)) {
                        push @bbase, "$bbase\::$entry";
                    } else {
                        next unless $entry =~ s/\.pm(?!\n)\Z//;
                        $CPAN::META-&gt;instance('CPAN::Bundle',"$bbase\::$entry");
                    }
                }
            }
        }
    }
}

#-&gt; sub CPAN::Shell::b ;
sub b {
    my($self,@which) = @_;
    CPAN-&gt;debug("which[@which]") if $CPAN::DEBUG;
    $self-&gt;local_bundles;
    $CPAN::Frontend-&gt;myprint($self-&gt;format_result('Bundle',@which));
}

#-&gt; sub CPAN::Shell::d ;
sub d { $CPAN::Frontend-&gt;myprint(shift-&gt;format_result('Distribution',@_));}

#-&gt; sub CPAN::Shell::m ;
sub m { # emacs confused here }; sub mimimimimi { # emacs in sync here
    my $self = shift;
    my @m = @_;
    for (@m) {
        if (m|(?:\w+/)*\w+\.pm$|) { # same regexp in expandany
            s/.pm$//;
            s|/|::|g;
        }
    }
    $CPAN::Frontend-&gt;myprint($self-&gt;format_result('Module',@m));
}

#-&gt; sub CPAN::Shell::i ;
sub i {
    my($self) = shift;
    my(@args) = @_;
    @args = '/./' unless @args;
    my(@result);
    for my $type (qw/Bundle Distribution Module/) {
        push @result, $self-&gt;expand($type,@args);
    }
    # Authors are always uppercase.
    push @result, $self-&gt;expand("Author", map { uc $_ } @args);

    my $result = @result == 1 ?
        $result[0]-&gt;as_string :
            @result == 0 ?
                "No objects found of any type for argument @args\n" :
                    join("",
                         (map {$_-&gt;as_glimpse} @result),
                         scalar @result, " items found\n",
                        );
    $CPAN::Frontend-&gt;myprint($result);
}

#-&gt; sub CPAN::Shell::o ;

# CPAN::Shell::o and CPAN::HandleConfig::edit are closely related. 'o
# conf' calls through to CPAN::HandleConfig::edit. 'o conf' should
# probably have been called 'set' and 'o debug' maybe 'set debug' or
# 'debug'; 'o conf ARGS' calls -&gt;edit in CPAN/HandleConfig.pm
sub o {
    my($self,$o_type,@o_what) = @_;
    $o_type ||= "";
    CPAN-&gt;debug("o_type[$o_type] o_what[".join(" | ",@o_what)."]\n");
    if ($o_type eq 'conf') {
        my($cfilter);
        ($cfilter) = $o_what[0] =~ m|^/(.*)/$| if @o_what;
        if (!@o_what or $cfilter) { # print all things, "o conf"
            $cfilter ||= "";
            my $qrfilter = eval 'qr/$cfilter/';
            my($k,$v);
            my $configpm = CPAN::HandleConfig-&gt;require_myconfig_or_config;
            $CPAN::Frontend-&gt;myprint("\$CPAN::Config options from $configpm\:\n");
            for $k (sort keys %CPAN::HandleConfig::can) {
                next unless $k =~ /$qrfilter/;
                $v = $CPAN::HandleConfig::can{$k};
                $CPAN::Frontend-&gt;myprint(sprintf "    %-18s [%s]\n", $k, $v);
            }
            $CPAN::Frontend-&gt;myprint("\n");
            for $k (sort keys %CPAN::HandleConfig::keys) {
                next unless $k =~ /$qrfilter/;
                CPAN::HandleConfig-&gt;prettyprint($k);
            }
            $CPAN::Frontend-&gt;myprint("\n");
        } else {
            if (CPAN::HandleConfig-&gt;edit(@o_what)) {
            } else {
                $CPAN::Frontend-&gt;myprint(qq{Type 'o conf' to view all configuration }.
                                         qq{items\n\n});
            }
        }
    } elsif ($o_type eq 'debug') {
        my(%valid);
        @o_what = () if defined $o_what[0] &amp;&amp; $o_what[0] =~ /help/i;
        if (@o_what) {
            while (@o_what) {
                my($what) = shift @o_what;
                if ($what =~ s/^-// &amp;&amp; exists $CPAN::DEBUG{$what}) {
                    $CPAN::DEBUG &amp;= $CPAN::DEBUG ^ $CPAN::DEBUG{$what};
                    next;
                }
                if ( exists $CPAN::DEBUG{$what} ) {
                    $CPAN::DEBUG |= $CPAN::DEBUG{$what};
                } elsif ($what =~ /^\d/) {
                    $CPAN::DEBUG = $what;
                } elsif (lc $what eq 'all') {
                    my($max) = 0;
                    for (values %CPAN::DEBUG) {
                        $max += $_;
                    }
                    $CPAN::DEBUG = $max;
                } else {
                    my($known) = 0;
                    for (keys %CPAN::DEBUG) {
                        next unless lc($_) eq lc($what);
                        $CPAN::DEBUG |= $CPAN::DEBUG{$_};
                        $known = 1;
                    }
                    $CPAN::Frontend-&gt;myprint("unknown argument [$what]\n")
                        unless $known;
                }
            }
        } else {
            my $raw = "Valid options for debug are ".
                join(", ",sort(keys %CPAN::DEBUG), 'all').
                     qq{ or a number. Completion works on the options. }.
                     qq{Case is ignored.};
            require Text::Wrap;
            $CPAN::Frontend-&gt;myprint(Text::Wrap::fill("","",$raw));
            $CPAN::Frontend-&gt;myprint("\n\n");
        }
        if ($CPAN::DEBUG) {
            $CPAN::Frontend-&gt;myprint("Options set for debugging ($CPAN::DEBUG):\n");
            my($k,$v);
            for $k (sort {$CPAN::DEBUG{$a} &lt;=&gt; $CPAN::DEBUG{$b}} keys %CPAN::DEBUG) {
                $v = $CPAN::DEBUG{$k};
                $CPAN::Frontend-&gt;myprint(sprintf "    %-14s(%s)\n", $k, $v)
                    if $v &amp; $CPAN::DEBUG;
            }
        } else {
            $CPAN::Frontend-&gt;myprint("Debugging turned off completely.\n");
        }
    } else {
        $CPAN::Frontend-&gt;myprint(qq{
Known options:
  conf    set or get configuration variables
  debug   set or get debugging options
});
    }
}

# CPAN::Shell::paintdots_onreload
sub paintdots_onreload {
    my($ref) = shift;
    sub {
        if ( $_[0] =~ /[Ss]ubroutine ([\w:]+) redefined/ ) {
            my($subr) = $1;
            ++$$ref;
            local($|) = 1;
            # $CPAN::Frontend-&gt;myprint(".($subr)");
            $CPAN::Frontend-&gt;myprint(".");
            if ($subr =~ /\bshell\b/i) {
                # warn "debug[$_[0]]";

                # It would be nice if we could detect that a
                # subroutine has actually changed, but for now we
                # practically always set the GOTOSHELL global

                $CPAN::GOTOSHELL=1;
            }
            return;
        }
        warn @_;
    };
}

#-&gt; sub CPAN::Shell::hosts ;
sub hosts {
    my($self) = @_;
    my $fullstats = CPAN::FTP-&gt;_ftp_statistics();
    my $history = $fullstats-&gt;{history} || [];
    my %S; # statistics
    while (my $last = pop @$history) {
        my $attempts = $last-&gt;{attempts} or next;
        my $start;
        if (@$attempts) {
            $start = $attempts-&gt;[-1]{start};
            if ($#$attempts &gt; 0) {
                for my $i (0..$#$attempts-1) {
                    my $url = $attempts-&gt;[$i]{url} or next;
                    $S{no}{$url}++;
                }
            }
        } else {
            $start = $last-&gt;{start};
        }
        next unless $last-&gt;{thesiteurl}; # C-C? bad filenames?
        $S{start} = $start;
        $S{end} ||= $last-&gt;{end};
        my $dltime = $last-&gt;{end} - $start;
        my $dlsize = $last-&gt;{filesize} || 0;
        my $url = ref $last-&gt;{thesiteurl} ? $last-&gt;{thesiteurl}-&gt;text : $last-&gt;{thesiteurl};
        my $s = $S{ok}{$url} ||= {};
        $s-&gt;{n}++;
        $s-&gt;{dlsize} ||= 0;
        $s-&gt;{dlsize} += $dlsize/1024;
        $s-&gt;{dltime} ||= 0;
        $s-&gt;{dltime} += $dltime;
    }
    my $res;
    for my $url (keys %{$S{ok}}) {
        next if $S{ok}{$url}{dltime} == 0; # div by zero
        push @{$res-&gt;{ok}}, [@{$S{ok}{$url}}{qw(n dlsize dltime)},
                             $S{ok}{$url}{dlsize}/$S{ok}{$url}{dltime},
                             $url,
                            ];
    }
    for my $url (keys %{$S{no}}) {
        push @{$res-&gt;{no}}, [$S{no}{$url},
                             $url,
                            ];
    }
    my $R = ""; # report
    if ($S{start} &amp;&amp; $S{end}) {
        $R .= sprintf "Log starts: %s\n", $S{start} ? scalar(localtime $S{start}) : "unknown";
        $R .= sprintf "Log ends  : %s\n", $S{end}   ? scalar(localtime $S{end})   : "unknown";
    }
    if ($res-&gt;{ok} &amp;&amp; @{$res-&gt;{ok}}) {
        $R .= sprintf "\nSuccessful downloads:
   N       kB  secs      kB/s url\n";
        my $i = 20;
        for (sort { $b-&gt;[3] &lt;=&gt; $a-&gt;[3] } @{$res-&gt;{ok}}) {
            $R .= sprintf "%4d %8d %5d %9.1f %s\n", @$_;
            last if --$i&lt;=0;
        }
    }
    if ($res-&gt;{no} &amp;&amp; @{$res-&gt;{no}}) {
        $R .= sprintf "\nUnsuccessful downloads:\n";
        my $i = 20;
        for (sort { $b-&gt;[0] &lt;=&gt; $a-&gt;[0] } @{$res-&gt;{no}}) {
            $R .= sprintf "%4d %s\n", @$_;
            last if --$i&lt;=0;
        }
    }
    $CPAN::Frontend-&gt;myprint($R);
}

# here is where 'reload cpan' is done
#-&gt; sub CPAN::Shell::reload ;
sub reload {
    my($self,$command,@arg) = @_;
    $command ||= "";
    $self-&gt;debug("self[$self]command[$command]arg[@arg]") if $CPAN::DEBUG;
    if ($command =~ /^cpan$/i) {
        my $redef = 0;
        chdir $CPAN::iCwd if $CPAN::iCwd; # may fail
        my $failed;
      MFILE: for my $f (@relo) {
            next unless exists $INC{$f};
            my $p = $f;
            $p =~ s/\.pm$//;
            $p =~ s|/|::|g;
            $CPAN::Frontend-&gt;myprint("($p");
            local($SIG{__WARN__}) = paintdots_onreload(\$redef);
            $self-&gt;_reload_this($f) or $failed++;
            my $v = eval "$p\::-&gt;VERSION";
            $CPAN::Frontend-&gt;myprint("v$v)");
        }
        $CPAN::Frontend-&gt;myprint("\n$redef subroutines redefined\n");
        if ($failed) {
            my $errors = $failed == 1 ? "error" : "errors";
            $CPAN::Frontend-&gt;mywarn("\n$failed $errors during reload. You better quit ".
                                    "this session.\n");
        }
    } elsif ($command =~ /^index$/i) {
      CPAN::Index-&gt;force_reload;
    } else {
      $CPAN::Frontend-&gt;myprint(qq{cpan     re-evals the CPAN modules
index    re-reads the index files\n});
    }
}

# reload means only load again what we have loaded before
#-&gt; sub CPAN::Shell::_reload_this ;
sub _reload_this {
    my($self,$f,$args) = @_;
    CPAN-&gt;debug("f[$f]") if $CPAN::DEBUG;
    return 1 unless $INC{$f}; # we never loaded this, so we do not
                              # reload but say OK
    my $pwd = CPAN::anycwd();
    CPAN-&gt;debug("pwd[$pwd]") if $CPAN::DEBUG;
    my($file);
    for my $inc (@INC) {
        $file = File::Spec-&gt;catfile($inc,split /\//, $f);
        last if -f $file;
        $file = "";
    }
    CPAN-&gt;debug("file[$file]") if $CPAN::DEBUG;
    my @inc = @INC;
    unless ($file &amp;&amp; -f $file) {
        # this thingie is not in the INC path, maybe CPAN/MyConfig.pm?
        $file = $INC{$f};
        unless (CPAN-&gt;has_inst("File::Basename")) {
            @inc = File::Basename::dirname($file);
        } else {
            # do we ever need this?
            @inc = substr($file,0,-length($f)-1); # bring in back to me!
        }
    }
    CPAN-&gt;debug("file[$file]inc[@inc]") if $CPAN::DEBUG;
    unless (-f $file) {
        $CPAN::Frontend-&gt;mywarn("Found no file to reload for '$f'\n");
        return;
    }
    my $mtime = (stat $file)[9];
    $reload-&gt;{$f} ||= -1;
    my $must_reload = $mtime != $reload-&gt;{$f};
    $args ||= {};
    $must_reload ||= $args-&gt;{reloforce}; # o conf defaults needs this
    if ($must_reload) {
        my $fh = FileHandle-&gt;new($file) or
            $CPAN::Frontend-&gt;mydie("Could not open $file: $!");
        local($/);
        local $^W = 1;
        my $content = &lt;$fh&gt;;
        CPAN-&gt;debug(sprintf("reload file[%s] content[%s...]",$file,substr($content,0,128)))
            if $CPAN::DEBUG;
        delete $INC{$f};
        local @INC = @inc;
        eval "require '$f'";
        if ($@) {
            warn $@;
            return;
        }
        $reload-&gt;{$f} = $mtime;
    } else {
        $CPAN::Frontend-&gt;myprint("__unchanged__");
    }
    return 1;
}

#-&gt; sub CPAN::Shell::mkmyconfig ;
sub mkmyconfig {
    my($self) = @_;
    if ( my $configpm = $INC{'CPAN/MyConfig.pm'} ) {
        $CPAN::Frontend-&gt;myprint(
            "CPAN::MyConfig already exists as $configpm.\n" .
            "Running configuration again...\n"
        );
    require CPAN::FirstTime;
        CPAN::FirstTime::init($configpm);
    }
    else {
        # force some missing values to be filled in with defaults
        delete $CPAN::Config-&gt;{$_}
            for qw/build_dir cpan_home keep_source_where histfile/;
        CPAN::HandleConfig-&gt;load( make_myconfig =&gt; 1 );
    }
}

#-&gt; sub CPAN::Shell::_binary_extensions ;
sub _binary_extensions {
    my($self) = shift @_;
    my(@result,$module,%seen,%need,$headerdone);
    for $module ($self-&gt;expand('Module','/./')) {
        my $file  = $module-&gt;cpan_file;
        next if $file eq "N/A";
        next if $file =~ /^Contact Author/;
        my $dist = $CPAN::META-&gt;instance('CPAN::Distribution',$file);
        next if $dist-&gt;isa_perl;
        next unless $module-&gt;xs_file;
        local($|) = 1;
        $CPAN::Frontend-&gt;myprint(".");
        push @result, $module;
    }
#    print join " | ", @result;
    $CPAN::Frontend-&gt;myprint("\n");
    return @result;
}

#-&gt; sub CPAN::Shell::recompile ;
sub recompile {
    my($self) = shift @_;
    my($module,@module,$cpan_file,%dist);
    @module = $self-&gt;_binary_extensions();
    for $module (@module) { # we force now and compile later, so we
                            # don't do it twice
        $cpan_file = $module-&gt;cpan_file;
        my $pack = $CPAN::META-&gt;instance('CPAN::Distribution',$cpan_file);
        $pack-&gt;force;
        $dist{$cpan_file}++;
    }
    for $cpan_file (sort keys %dist) {
        $CPAN::Frontend-&gt;myprint("  CPAN: Recompiling $cpan_file\n\n");
        my $pack = $CPAN::META-&gt;instance('CPAN::Distribution',$cpan_file);
        $pack-&gt;install;
        $CPAN::Signal = 0; # it's tempting to reset Signal, so we can
                           # stop a package from recompiling,
                           # e.g. IO-1.12 when we have perl5.003_10
    }
}

#-&gt; sub CPAN::Shell::scripts ;
sub scripts {
    my($self, $arg) = @_;
    $CPAN::Frontend-&gt;mywarn("&gt;&gt;&gt;&gt; experimental command, currently unsupported &lt;&lt;&lt;&lt;\n\n");

    for my $req (qw( HTML::LinkExtor Sort::Versions List::Util )) {
        unless ($CPAN::META-&gt;has_inst($req)) {
            $CPAN::Frontend-&gt;mywarn("  $req not available\n");
        }
    }
    my $p = HTML::LinkExtor-&gt;new();
    my $indexfile = "/home/ftp/pub/PAUSE/scripts/new/index.html";
    unless (-f $indexfile) {
        $CPAN::Frontend-&gt;mydie("found no indexfile[$indexfile]\n");
    }
    $p-&gt;parse_file($indexfile);
    my @hrefs;
    my $qrarg;
    if ($arg =~ s|^/(.+)/$|$1|) {
        $qrarg = eval 'qr/$arg/'; # hide construct from 5.004
    }
    for my $l ($p-&gt;links) {
        my $tag = shift @$l;
        next unless $tag eq "a";
        my %att = @$l;
        my $href = $att{href};
        next unless $href =~ s|^\.\./authors/id/./../||;
        if ($arg) {
            if ($qrarg) {
                if ($href =~ $qrarg) {
                    push @hrefs, $href;
                }
            } else {
                if ($href =~ /\Q$arg\E/) {
                    push @hrefs, $href;
                }
            }
        } else {
            push @hrefs, $href;
        }
    }
    # now filter for the latest version if there is more than one of a name
    my %stems;
    for (sort @hrefs) {
        my $href = $_;
        s/-v?\d.*//;
        my $stem = $_;
        $stems{$stem} ||= [];
        push @{$stems{$stem}}, $href;
    }
    for (sort keys %stems) {
        my $highest;
        if (@{$stems{$_}} &gt; 1) {
            $highest = List::Util::reduce {
                Sort::Versions::versioncmp($a,$b) &gt; 0 ? $a : $b
              } @{$stems{$_}};
        } else {
            $highest = $stems{$_}[0];
        }
        $CPAN::Frontend-&gt;myprint("$highest\n");
    }
}

#-&gt; sub CPAN::Shell::report ;
sub report {
    my($self,@args) = @_;
    unless ($CPAN::META-&gt;has_inst("CPAN::Reporter")) {
        $CPAN::Frontend-&gt;mydie("CPAN::Reporter not installed; cannot continue");
    }
    local $CPAN::Config-&gt;{test_report} = 1;
    $self-&gt;force("test",@args); # force is there so that the test be
                                # re-run (as documented)
}

# compare with is_tested
#-&gt; sub CPAN::Shell::install_tested
sub install_tested {
    my($self,@some) = @_;
    $CPAN::Frontend-&gt;mywarn("install_tested() must not be called with arguments.\n"),
        return if @some;
    CPAN::Index-&gt;reload;

    for my $b (reverse $CPAN::META-&gt;_list_sorted_descending_is_tested) {
        my $yaml = "$b.yml";
        unless (-f $yaml) {
            $CPAN::Frontend-&gt;mywarn("No YAML file for $b available, skipping\n");
            next;
        }
        my $yaml_content = CPAN-&gt;_yaml_loadfile($yaml);
        my $id = $yaml_content-&gt;[0]{distribution}{ID};
        unless ($id) {
            $CPAN::Frontend-&gt;mywarn("No ID found in '$yaml', skipping\n");
            next;
        }
        my $do = CPAN::Shell-&gt;expandany($id);
        unless ($do) {
            $CPAN::Frontend-&gt;mywarn("Could not expand ID '$id', skipping\n");
            next;
        }
        unless ($do-&gt;{build_dir}) {
            $CPAN::Frontend-&gt;mywarn("Distro '$id' has no build_dir, skipping\n");
            next;
        }
        unless ($do-&gt;{build_dir} eq $b) {
            $CPAN::Frontend-&gt;mywarn("Distro '$id' has build_dir '$do-&gt;{build_dir}' but expected '$b', skipping\n");
            next;
        }
        push @some, $do;
    }

    $CPAN::Frontend-&gt;mywarn("No tested distributions found.\n"),
        return unless @some;

    @some = grep { $_-&gt;{make_test} &amp;&amp; ! $_-&gt;{make_test}-&gt;failed } @some;
    $CPAN::Frontend-&gt;mywarn("No distributions tested with this build of perl found.\n"),
        return unless @some;

    # @some = grep { not $_-&gt;uptodate } @some;
    # $CPAN::Frontend-&gt;mywarn("No non-uptodate distributions tested with this build of perl found.\n"),
    #     return unless @some;

    CPAN-&gt;debug("some[@some]");
    for my $d (@some) {
        my $id = $d-&gt;can("pretty_id") ? $d-&gt;pretty_id : $d-&gt;id;
        $CPAN::Frontend-&gt;myprint("install_tested: Running for $id\n");
        $CPAN::Frontend-&gt;mysleep(1);
        $self-&gt;install($d);
    }
}

#-&gt; sub CPAN::Shell::upgrade ;
sub upgrade {
    my($self,@args) = @_;
    $self-&gt;install($self-&gt;r(@args));
}

#-&gt; sub CPAN::Shell::_u_r_common ;
sub _u_r_common {
    my($self) = shift @_;
    my($what) = shift @_;
    CPAN-&gt;debug("self[$self] what[$what] args[@_]") if $CPAN::DEBUG;
    Carp::croak "Usage: \$obj-&gt;_u_r_common(a|r|u)" unless
          $what &amp;&amp; $what =~ /^[aru]$/;
    my(@args) = @_;
    @args = '/./' unless @args;
    my(@result,$module,%seen,%need,$headerdone,
       $version_undefs,$version_zeroes,
       @version_undefs,@version_zeroes);
    $version_undefs = $version_zeroes = 0;
    my $sprintf = "%s%-25s%s %9s %9s  %s\n";
    my @expand = $self-&gt;expand('Module',@args);
    if ($CPAN::DEBUG) { # Looks like noise to me, was very useful for debugging
             # for metadata cache
        my $expand = scalar @expand;
        $CPAN::Frontend-&gt;myprint(sprintf "%d matches in the database, time[%d]\n", $expand, time);
    }
    my @sexpand;
    if ($] &lt; 5.008) {
        # hard to believe that the more complex sorting can lead to
        # stack curruptions on older perl
        @sexpand = sort {$a-&gt;id cmp $b-&gt;id} @expand;
    } else {
        @sexpand = map {
            $_-&gt;[1]
        } sort {
            $b-&gt;[0] &lt;=&gt; $a-&gt;[0]
            ||
            $a-&gt;[1]{ID} cmp $b-&gt;[1]{ID},
        } map {
            [$_-&gt;_is_representative_module,
             $_
            ]
        } @expand;
    }
    if ($CPAN::DEBUG) {
        $CPAN::Frontend-&gt;myprint(sprintf "sorted at time[%d]\n", time);
        sleep 1;
    }
  MODULE: for $module (@sexpand) {
        my $file  = $module-&gt;cpan_file;
        next MODULE unless defined $file; # ??
        $file =~ s!^./../!!;
        my($latest) = $module-&gt;cpan_version;
        my($inst_file) = $module-&gt;inst_file;
        CPAN-&gt;debug("file[$file]latest[$latest]") if $CPAN::DEBUG;
        my($have);
        return if $CPAN::Signal;
        my($next_MODULE);
        eval { # version.pm involved!
            if ($inst_file) {
                if ($what eq "a") {
                    $have = $module-&gt;inst_version;
                } elsif ($what eq "r") {
                    $have = $module-&gt;inst_version;
                    local($^W) = 0;
                    if ($have eq "undef") {
                        $version_undefs++;
                        push @version_undefs, $module-&gt;as_glimpse;
                    } elsif (CPAN::Version-&gt;vcmp($have,0)==0) {
                        $version_zeroes++;
                        push @version_zeroes, $module-&gt;as_glimpse;
                    }
                    ++$next_MODULE unless CPAN::Version-&gt;vgt($latest, $have);
                    # to be pedantic we should probably say:
                    #    &amp;&amp; !($have eq "undef" &amp;&amp; $latest ne "undef" &amp;&amp; $latest gt "");
                    # to catch the case where CPAN has a version 0 and we have a version undef
                } elsif ($what eq "u") {
                    ++$next_MODULE;
                }
            } else {
                if ($what eq "a") {
                    ++$next_MODULE;
                } elsif ($what eq "r") {
                    ++$next_MODULE;
                } elsif ($what eq "u") {
                    $have = "-";
                }
            }
        };
        next MODULE if $next_MODULE;
        if ($@) {
            $CPAN::Frontend-&gt;mywarn
                (sprintf("Error while comparing cpan/installed versions of '%s':
INST_FILE: %s
INST_VERSION: %s %s
CPAN_VERSION: %s %s
",
                         $module-&gt;id,
                         $inst_file || "",
                         (defined $have ? $have : "[UNDEFINED]"),
                         (ref $have ? ref $have : ""),
                         $latest,
                         (ref $latest ? ref $latest : ""),
                        ));
            next MODULE;
        }
        return if $CPAN::Signal; # this is sometimes lengthy
        $seen{$file} ||= 0;
        if ($what eq "a") {
            push @result, sprintf "%s %s\n", $module-&gt;id, $have;
        } elsif ($what eq "r") {
            push @result, $module-&gt;id;
            next MODULE if $seen{$file}++;
        } elsif ($what eq "u") {
            push @result, $module-&gt;id;
            next MODULE if $seen{$file}++;
            next MODULE if $file =~ /^Contact/;
        }
        unless ($headerdone++) {
            $CPAN::Frontend-&gt;myprint("\n");
            $CPAN::Frontend-&gt;myprint(sprintf(
                                             $sprintf,
                                             "",
                                             "Package namespace",
                                             "",
                                             "installed",
                                             "latest",
                                             "in CPAN file"
                                            ));
        }
        my $color_on = "";
        my $color_off = "";
        if (
            $COLOR_REGISTERED
            &amp;&amp;
            $CPAN::META-&gt;has_inst("Term::ANSIColor")
            &amp;&amp;
            $module-&gt;description
           ) {
            $color_on = Term::ANSIColor::color("green");
            $color_off = Term::ANSIColor::color("reset");
        }
        $CPAN::Frontend-&gt;myprint(sprintf $sprintf,
                                 $color_on,
                                 $module-&gt;id,
                                 $color_off,
                                 $have,
                                 $latest,
                                 $file);
        $need{$module-&gt;id}++;
    }
    unless (%need) {
        if ($what eq "u") {
            $CPAN::Frontend-&gt;myprint("No modules found for @args\n");
        } elsif ($what eq "r") {
            $CPAN::Frontend-&gt;myprint("All modules are up to date for @args\n");
        }
    }
    if ($what eq "r") {
        if ($version_zeroes) {
            my $s_has = $version_zeroes &gt; 1 ? "s have" : " has";
            $CPAN::Frontend-&gt;myprint(qq{$version_zeroes installed module$s_has }.
                                     qq{a version number of 0\n});
            if ($CPAN::Config-&gt;{show_zero_versions}) {
                local $" = "\t";
                $CPAN::Frontend-&gt;myprint(qq{  they are\n\t@version_zeroes\n});
                $CPAN::Frontend-&gt;myprint(qq{(use 'o conf show_zero_versions 0' }.
                                         qq{to hide them)\n});
            } else {
                $CPAN::Frontend-&gt;myprint(qq{(use 'o conf show_zero_versions 1' }.
                                         qq{to show them)\n});
            }
        }
        if ($version_undefs) {
            my $s_has = $version_undefs &gt; 1 ? "s have" : " has";
            $CPAN::Frontend-&gt;myprint(qq{$version_undefs installed module$s_has no }.
                                     qq{parsable version number\n});
            if ($CPAN::Config-&gt;{show_unparsable_versions}) {
                local $" = "\t";
                $CPAN::Frontend-&gt;myprint(qq{  they are\n\t@version_undefs\n});
                $CPAN::Frontend-&gt;myprint(qq{(use 'o conf show_unparsable_versions 0' }.
                                         qq{to hide them)\n});
            } else {
                $CPAN::Frontend-&gt;myprint(qq{(use 'o conf show_unparsable_versions 1' }.
                                         qq{to show them)\n});
            }
        }
    }
    @result;
}

#-&gt; sub CPAN::Shell::r ;
sub r {
    shift-&gt;_u_r_common("r",@_);
}

#-&gt; sub CPAN::Shell::u ;
sub u {
    shift-&gt;_u_r_common("u",@_);
}

#-&gt; sub CPAN::Shell::failed ;
sub failed {
    my($self,$only_id,$silent) = @_;
    my @failed;
  DIST: for my $d ($CPAN::META-&gt;all_objects("CPAN::Distribution")) {
        my $failed = "";
      NAY: for my $nosayer ( # order matters!
                            "unwrapped",
                            "writemakefile",
                            "signature_verify",
                            "make",
                            "make_test",
                            "install",
                            "make_clean",
                           ) {
            next unless exists $d-&gt;{$nosayer};
            next unless defined $d-&gt;{$nosayer};
            next unless (
                         UNIVERSAL::can($d-&gt;{$nosayer},"failed") ?
                         $d-&gt;{$nosayer}-&gt;failed :
                         $d-&gt;{$nosayer} =~ /^NO/
                        );
            next NAY if $only_id &amp;&amp; $only_id != (
                                                 UNIVERSAL::can($d-&gt;{$nosayer},"commandid")
                                                 ?
                                                 $d-&gt;{$nosayer}-&gt;commandid
                                                 :
                                                 $CPAN::CurrentCommandId
                                                );
            $failed = $nosayer;
            last;
        }
        next DIST unless $failed;
        my $id = $d-&gt;id;
        $id =~ s|^./../||;
        #$print .= sprintf(
        #                  "  %-45s: %s %s\n",
        push @failed,
            (
             UNIVERSAL::can($d-&gt;{$failed},"failed") ?
             [
              $d-&gt;{$failed}-&gt;commandid,
              $id,
              $failed,
              $d-&gt;{$failed}-&gt;text,
              $d-&gt;{$failed}{TIME}||0,
             ] :
             [
              1,
              $id,
              $failed,
              $d-&gt;{$failed},
              0,
             ]
            );
    }
    my $scope;
    if ($only_id) {
        $scope = "this command";
    } elsif ($CPAN::Index::HAVE_REANIMATED) {
        $scope = "this or a previous session";
        # it might be nice to have a section for previous session and
        # a second for this
    } else {
        $scope = "this session";
    }
    if (@failed) {
        my $print;
        my $debug = 0;
        if ($debug) {
            $print = join "",
                map { sprintf "%5d %-45s: %s %s\n", @$_ }
                    sort { $a-&gt;[0] &lt;=&gt; $b-&gt;[0] } @failed;
        } else {
            $print = join "",
                map { sprintf " %-45s: %s %s\n", @$_[1..3] }
                    sort {
                        $a-&gt;[0] &lt;=&gt; $b-&gt;[0]
                            ||
                                $a-&gt;[4] &lt;=&gt; $b-&gt;[4]
                       } @failed;
        }
        $CPAN::Frontend-&gt;myprint("Failed during $scope:\n$print");
    } elsif (!$only_id || !$silent) {
        $CPAN::Frontend-&gt;myprint("Nothing failed in $scope\n");
    }
}

# XXX intentionally undocumented because completely bogus, unportable,
# useless, etc.

#-&gt; sub CPAN::Shell::status ;
sub status {
    my($self) = @_;
    require Devel::Size;
    my $ps = FileHandle-&gt;new;
    open $ps, "/proc/$$/status";
    my $vm = 0;
    while (&lt;$ps&gt;) {
        next unless /VmSize:\s+(\d+)/;
        $vm = $1;
        last;
    }
    $CPAN::Frontend-&gt;mywarn(sprintf(
                                    "%-27s %6d\n%-27s %6d\n",
                                    "vm",
                                    $vm,
                                    "CPAN::META",
                                    Devel::Size::total_size($CPAN::META)/1024,
                                   ));
    for my $k (sort keys %$CPAN::META) {
        next unless substr($k,0,4) eq "read";
        warn sprintf " %-26s %6d\n", $k, Devel::Size::total_size($CPAN::META-&gt;{$k})/1024;
        for my $k2 (sort keys %{$CPAN::META-&gt;{$k}}) {
            warn sprintf "  %-25s %6d (keys: %6d)\n",
                $k2,
                    Devel::Size::total_size($CPAN::META-&gt;{$k}{$k2})/1024,
                          scalar keys %{$CPAN::META-&gt;{$k}{$k2}};
        }
    }
}

# compare with install_tested
#-&gt; sub CPAN::Shell::is_tested
sub is_tested {
    my($self) = @_;
    CPAN::Index-&gt;reload;
    for my $b (reverse $CPAN::META-&gt;_list_sorted_descending_is_tested) {
        my $time;
        if ($CPAN::META-&gt;{is_tested}{$b}) {
            $time = scalar(localtime $CPAN::META-&gt;{is_tested}{$b});
        } else {
            $time = scalar localtime;
            $time =~ s/\S/?/g;
        }
        $CPAN::Frontend-&gt;myprint(sprintf "%s %s\n", $time, $b);
    }
}

#-&gt; sub CPAN::Shell::autobundle ;
sub autobundle {
    my($self) = shift;
    CPAN::HandleConfig-&gt;load unless $CPAN::Config_loaded++;
    my(@bundle) = $self-&gt;_u_r_common("a",@_);
    my($todir) = File::Spec-&gt;catdir($CPAN::Config-&gt;{'cpan_home'},"Bundle");
    File::Path::mkpath($todir);
    unless (-d $todir) {
        $CPAN::Frontend-&gt;myprint("Couldn't mkdir $todir for some reason\n");
        return;
    }
    my($y,$m,$d) =  (localtime)[5,4,3];
    $y+=1900;
    $m++;
    my($c) = 0;
    my($me) = sprintf "Snapshot_%04d_%02d_%02d_%02d", $y, $m, $d, $c;
    my($to) = File::Spec-&gt;catfile($todir,"$me.pm");
    while (-f $to) {
        $me = sprintf "Snapshot_%04d_%02d_%02d_%02d", $y, $m, $d, ++$c;
        $to = File::Spec-&gt;catfile($todir,"$me.pm");
    }
    my($fh) = FileHandle-&gt;new("&gt;$to") or Carp::croak "Can't open &gt;$to: $!";
    $fh-&gt;print(
               "package Bundle::$me;\n\n",
               "\$","VERSION = '0.01';\n\n", # hide from perl-reversion
               "1;\n\n",
               "__END__\n\n",
               "=head1 NAME\n\n",
               "Bundle::$me - Snapshot of installation on ",
               $Config::Config{'myhostname'},
               " on ",
               scalar(localtime),
               "\n\n=head1 SYNOPSIS\n\n",
               "perl -MCPAN -e 'install Bundle::$me'\n\n",
               "=head1 CONTENTS\n\n",
               join("\n", @bundle),
               "\n\n=head1 CONFIGURATION\n\n",
               Config-&gt;myconfig,
               "\n\n=head1 AUTHOR\n\n",
               "This Bundle has been generated automatically ",
               "by the autobundle routine in CPAN.pm.\n",
              );
    $fh-&gt;close;
    $CPAN::Frontend-&gt;myprint("\nWrote bundle file
    $to\n\n");
}

#-&gt; sub CPAN::Shell::expandany ;
sub expandany {
    my($self,$s) = @_;
    CPAN-&gt;debug("s[$s]") if $CPAN::DEBUG;
    my $module_as_path = "";
    if ($s =~ m|(?:\w+/)*\w+\.pm$|) { # same regexp in sub m
        $module_as_path = $s;
        $module_as_path =~ s/.pm$//;
        $module_as_path =~ s|/|::|g;
    }
    if ($module_as_path) {
        if ($module_as_path =~ m|^Bundle::|) {
            $self-&gt;local_bundles;
            return $self-&gt;expand('Bundle',$module_as_path);
        } else {
            return $self-&gt;expand('Module',$module_as_path)
                if $CPAN::META-&gt;exists('CPAN::Module',$module_as_path);
        }
    } elsif ($s =~ m|/| or substr($s,-1,1) eq ".") { # looks like a file or a directory
        $s = CPAN::Distribution-&gt;normalize($s);
        return $CPAN::META-&gt;instance('CPAN::Distribution',$s);
        # Distributions spring into existence, not expand
    } elsif ($s =~ m|^Bundle::|) {
        $self-&gt;local_bundles; # scanning so late for bundles seems
                              # both attractive and crumpy: always
                              # current state but easy to forget
                              # somewhere
        return $self-&gt;expand('Bundle',$s);
    } else {
        return $self-&gt;expand('Module',$s)
            if $CPAN::META-&gt;exists('CPAN::Module',$s);
    }
    return;
}

#-&gt; sub CPAN::Shell::expand ;
sub expand {
    my $self = shift;
    my($type,@args) = @_;
    CPAN-&gt;debug("type[$type]args[@args]") if $CPAN::DEBUG;
    my $class = "CPAN::$type";
    my $methods = ['id'];
    for my $meth (qw(name)) {
        next unless $class-&gt;can($meth);
        push @$methods, $meth;
    }
    $self-&gt;expand_by_method($class,$methods,@args);
}

#-&gt; sub CPAN::Shell::expand_by_method ;
sub expand_by_method {
    my $self = shift;
    my($class,$methods,@args) = @_;
    my($arg,@m);
    for $arg (@args) {
        my($regex,$command);
        if ($arg =~ m|^/(.*)/$|) {
            $regex = $1;
# FIXME:  there seem to be some ='s in the author data, which trigger
#         a failure here.  This needs to be contemplated.
#            } elsif ($arg =~ m/=/) {
#                $command = 1;
        }
        my $obj;
        CPAN-&gt;debug(sprintf "class[%s]regex[%s]command[%s]",
                    $class,
                    defined $regex ? $regex : "UNDEFINED",
                    defined $command ? $command : "UNDEFINED",
                   ) if $CPAN::DEBUG;
        if (defined $regex) {
            if (CPAN::_sqlite_running()) {
                CPAN::Index-&gt;reload;
                $CPAN::SQLite-&gt;search($class, $regex);
            }
            for $obj (
                      $CPAN::META-&gt;all_objects($class)
                     ) {
                unless ($obj &amp;&amp; UNIVERSAL::can($obj,"id") &amp;&amp; $obj-&gt;id) {
                    # BUG, we got an empty object somewhere
                    require Data::Dumper;
                    CPAN-&gt;debug(sprintf(
                                        "Bug in CPAN: Empty id on obj[%s][%s]",
                                        $obj,
                                        Data::Dumper::Dumper($obj)
                                       )) if $CPAN::DEBUG;
                    next;
                }
                for my $method (@$methods) {
                    my $match = eval {$obj-&gt;$method() =~ /$regex/i};
                    if ($@) {
                        my($err) = $@ =~ /^(.+) at .+? line \d+\.$/;
                        $err ||= $@; # if we were too restrictive above
                        $CPAN::Frontend-&gt;mydie("$err\n");
                    } elsif ($match) {
                        push @m, $obj;
                        last;
                    }
                }
            }
        } elsif ($command) {
            die "equal sign in command disabled (immature interface), ".
                "you can set
 ! \$CPAN::Shell::ADVANCED_QUERY=1
to enable it. But please note, this is HIGHLY EXPERIMENTAL code
that may go away anytime.\n"
                    unless $ADVANCED_QUERY;
            my($method,$criterion) = $arg =~ /(.+?)=(.+)/;
            my($matchcrit) = $criterion =~ m/^~(.+)/;
            for my $self (
                          sort
                          {$a-&gt;id cmp $b-&gt;id}
                          $CPAN::META-&gt;all_objects($class)
                         ) {
                my $lhs = $self-&gt;$method() or next; # () for 5.00503
                if ($matchcrit) {
                    push @m, $self if $lhs =~ m/$matchcrit/;
                } else {
                    push @m, $self if $lhs eq $criterion;
                }
            }
        } else {
            my($xarg) = $arg;
            if ( $class eq 'CPAN::Bundle' ) {
                $xarg =~ s/^(Bundle::)?(.*)/Bundle::$2/;
            } elsif ($class eq "CPAN::Distribution") {
                $xarg = CPAN::Distribution-&gt;normalize($arg);
            } else {
                $xarg =~ s/:+/::/g;
            }
            if ($CPAN::META-&gt;exists($class,$xarg)) {
                $obj = $CPAN::META-&gt;instance($class,$xarg);
            } elsif ($CPAN::META-&gt;exists($class,$arg)) {
                $obj = $CPAN::META-&gt;instance($class,$arg);
            } else {
                next;
            }
            push @m, $obj;
        }
    }
    @m = sort {$a-&gt;id cmp $b-&gt;id} @m;
    if ( $CPAN::DEBUG ) {
        my $wantarray = wantarray;
        my $join_m = join ",", map {$_-&gt;id} @m;
        # $self-&gt;debug("wantarray[$wantarray]join_m[$join_m]");
        my $count = scalar @m;
        $self-&gt;debug("class[$class]wantarray[$wantarray]count m[$count]");
    }
    return wantarray ? @m : $m[0];
}

#-&gt; sub CPAN::Shell::format_result ;
sub format_result {
    my($self) = shift;
    my($type,@args) = @_;
    @args = '/./' unless @args;
    my(@result) = $self-&gt;expand($type,@args);
    my $result = @result == 1 ?
        $result[0]-&gt;as_string :
            @result == 0 ?
                "No objects of type $type found for argument @args\n" :
                    join("",
                         (map {$_-&gt;as_glimpse} @result),
                         scalar @result, " items found\n",
                        );
    $result;
}

#-&gt; sub CPAN::Shell::report_fh ;
{
    my $installation_report_fh;
    my $previously_noticed = 0;

    sub report_fh {
        return $installation_report_fh if $installation_report_fh;
        if ($CPAN::META-&gt;has_usable("File::Temp")) {
            $installation_report_fh
                = File::Temp-&gt;new(
                                  dir      =&gt; File::Spec-&gt;tmpdir,
                                  template =&gt; 'cpan_install_XXXX',
                                  suffix   =&gt; '.txt',
                                  unlink   =&gt; 0,
                                 );
        }
        unless ( $installation_report_fh ) {
            warn("Couldn't open installation report file; " .
                 "no report file will be generated."
                ) unless $previously_noticed++;
        }
    }
}


# The only reason for this method is currently to have a reliable
# debugging utility that reveals which output is going through which
# channel. No, I don't like the colors ;-)

# to turn colordebugging on, write
# cpan&gt; o conf colorize_output 1

#-&gt; sub CPAN::Shell::colorize_output ;
{
    my $print_ornamented_have_warned = 0;
    sub colorize_output {
        my $colorize_output = $CPAN::Config-&gt;{colorize_output};
        if ($colorize_output &amp;&amp; !$CPAN::META-&gt;has_inst("Term::ANSIColor")) {
            unless ($print_ornamented_have_warned++) {
                # no myprint/mywarn within myprint/mywarn!
                warn "Colorize_output is set to true but Term::ANSIColor is not
installed. To activate colorized output, please install Term::ANSIColor.\n\n";
            }
            $colorize_output = 0;
        }
        return $colorize_output;
    }
}


#-&gt; sub CPAN::Shell::print_ornamented ;
sub print_ornamented {
    my($self,$what,$ornament) = @_;
    return unless defined $what;

    local $| = 1; # Flush immediately
    if ( $CPAN::Be_Silent ) {
        # WARNING: variable Be_Silent is poisoned and must be eliminated.
        print {report_fh()} $what;
        return;
    }
    my $swhat = "$what"; # stringify if it is an object
    if ($CPAN::Config-&gt;{term_is_latin}) {
        # note: deprecated, need to switch to $LANG and $LC_*
        # courtesy jhi:
        $swhat
            =~ s{([\xC0-\xDF])([\x80-\xBF])}{chr(ord($1)&lt;&lt;6&amp;0xC0|ord($2)&amp;0x3F)}eg; #};
    }
    if ($self-&gt;colorize_output) {
        if ( $CPAN::DEBUG &amp;&amp; $swhat =~ /^Debug\(/ ) {
            # if you want to have this configurable, please file a bugreport
            $ornament = $CPAN::Config-&gt;{colorize_debug} || "black on_cyan";
        }
        my $color_on = eval { Term::ANSIColor::color($ornament) } || "";
        if ($@) {
            print "Term::ANSIColor rejects color[$ornament]: $@\n
Please choose a different color (Hint: try 'o conf init /color/')\n";
        }
        # GGOLDBACH/Test-GreaterVersion-0.008 broke without this
        # $trailer construct. We want the newline be the last thing if
        # there is a newline at the end ensuring that the next line is
        # empty for other players
        my $trailer = "";
        $trailer = $1 if $swhat =~ s/([\r\n]+)\z//;
        print $color_on,
            $swhat,
                Term::ANSIColor::color("reset"),
                      $trailer;
    } else {
        print $swhat;
    }
}

#-&gt; sub CPAN::Shell::myprint ;

# where is myprint/mywarn/Frontend/etc. documented? Where to use what?
# I think, we send everything to STDOUT and use print for normal/good
# news and warn for news that need more attention. Yes, this is our
# working contract for now.
sub myprint {
    my($self,$what) = @_;
    $self-&gt;print_ornamented($what,
                            $CPAN::Config-&gt;{colorize_print}||'bold blue on_white',
                           );
}

my %already_printed;
#-&gt; sub CPAN::Shell::mywarnonce ;
sub myprintonce {
    my($self,$what) = @_;
    $self-&gt;myprint($what) unless $already_printed{$what}++;
}

sub optprint {
    my($self,$category,$what) = @_;
    my $vname = $category . "_verbosity";
    CPAN::HandleConfig-&gt;load unless $CPAN::Config_loaded++;
    if (!$CPAN::Config-&gt;{$vname}
        || $CPAN::Config-&gt;{$vname} =~ /^v/
       ) {
        $CPAN::Frontend-&gt;myprint($what);
    }
}

#-&gt; sub CPAN::Shell::myexit ;
sub myexit {
    my($self,$what) = @_;
    $self-&gt;myprint($what);
    exit;
}

#-&gt; sub CPAN::Shell::mywarn ;
sub mywarn {
    my($self,$what) = @_;
    $self-&gt;print_ornamented($what, $CPAN::Config-&gt;{colorize_warn}||'bold red on_white');
}

my %already_warned;
#-&gt; sub CPAN::Shell::mywarnonce ;
sub mywarnonce {
    my($self,$what) = @_;
    $self-&gt;mywarn($what) unless $already_warned{$what}++;
}

# only to be used for shell commands
#-&gt; sub CPAN::Shell::mydie ;
sub mydie {
    my($self,$what) = @_;
    $self-&gt;mywarn($what);

    # If it is the shell, we want the following die to be silent,
    # but if it is not the shell, we would need a 'die $what'. We need
    # to take care that only shell commands use mydie. Is this
    # possible?

    die "\n";
}

# sub CPAN::Shell::colorable_makemaker_prompt ;
sub colorable_makemaker_prompt {
    my($foo,$bar) = @_;
    if (CPAN::Shell-&gt;colorize_output) {
        my $ornament = $CPAN::Config-&gt;{colorize_print}||'bold blue on_white';
        my $color_on = eval { Term::ANSIColor::color($ornament); } || "";
        print $color_on;
    }
    my $ans = ExtUtils::MakeMaker::prompt($foo,$bar);
    if (CPAN::Shell-&gt;colorize_output) {
        print Term::ANSIColor::color('reset');
    }
    return $ans;
}

# use this only for unrecoverable errors!
#-&gt; sub CPAN::Shell::unrecoverable_error ;
sub unrecoverable_error {
    my($self,$what) = @_;
    my @lines = split /\n/, $what;
    my $longest = 0;
    for my $l (@lines) {
        $longest = length $l if length $l &gt; $longest;
    }
    $longest = 62 if $longest &gt; 62;
    for my $l (@lines) {
        if ($l =~ /^\s*$/) {
            $l = "\n";
            next;
        }
        $l = "==&gt; $l";
        if (length $l &lt; 66) {
            $l = pack "A66 A*", $l, "&lt;==";
        }
        $l .= "\n";
    }
    unshift @lines, "\n";
    $self-&gt;mydie(join "", @lines);
}

#-&gt; sub CPAN::Shell::mysleep ;
sub mysleep {
    my($self, $sleep) = @_;
    if (CPAN-&gt;has_inst("Time::HiRes")) {
        Time::HiRes::sleep($sleep);
    } else {
        sleep($sleep &lt; 1 ? 1 : int($sleep + 0.5));
    }
}

#-&gt; sub CPAN::Shell::setup_output ;
sub setup_output {
    return if -t STDOUT;
    my $odef = select STDERR;
    $| = 1;
    select STDOUT;
    $| = 1;
    select $odef;
}

#-&gt; sub CPAN::Shell::rematein ;
# RE-adme||MA-ke||TE-st||IN-stall : nearly everything runs through here
sub rematein {
    my $self = shift;
    # this variable was global and disturbed programmers, so localize:
    local $CPAN::Distrostatus::something_has_failed_at;
    my($meth,@some) = @_;
    my @pragma;
    while($meth =~ /^(ff?orce|notest)$/) {
        push @pragma, $meth;
        $meth = shift @some or
            $CPAN::Frontend-&gt;mydie("Pragma $pragma[-1] used without method: ".
                                   "cannot continue");
    }
    setup_output();
    CPAN-&gt;debug("pragma[@pragma]meth[$meth]some[@some]") if $CPAN::DEBUG;

    # Here is the place to set "test_count" on all involved parties to
    # 0. We then can pass this counter on to the involved
    # distributions and those can refuse to test if test_count &gt; X. In
    # the first stab at it we could use a 1 for "X".

    # But when do I reset the distributions to start with 0 again?
    # Jost suggested to have a random or cycling interaction ID that
    # we pass through. But the ID is something that is just left lying
    # around in addition to the counter, so I'd prefer to set the
    # counter to 0 now, and repeat at the end of the loop. But what
    # about dependencies? They appear later and are not reset, they
    # enter the queue but not its copy. How do they get a sensible
    # test_count?

    # With configure_requires, "get" is vulnerable in recursion.

    my $needs_recursion_protection = "get|make|test|install";

    # construct the queue
    my($s,@s,@qcopy);
  STHING: foreach $s (@some) {
        my $obj;
        if (ref $s) {
            CPAN-&gt;debug("s is an object[$s]") if $CPAN::DEBUG;
            $obj = $s;
        } elsif ($s =~ m|[\$\@\%]|) { # looks like a perl variable
        } elsif ($s =~ m|^/|) { # looks like a regexp
            if (substr($s,-1,1) eq ".") {
                $obj = CPAN::Shell-&gt;expandany($s);
            } else {
                my @obj;
            CLASS: for my $class (qw(Distribution Bundle Module)) {
                    if (@obj = $self-&gt;expand($class,$s)) {
                        last CLASS;
                    }
                }
                if (@obj) {
                    if (1==@obj) {
                        $obj = $obj[0];
                    } else {
                        $CPAN::Frontend-&gt;mywarn("Sorry, $meth with a regular expression is ".
                                                "only supported when unambiguous.\nRejecting argument '$s'\n");
                        $CPAN::Frontend-&gt;mysleep(2);
                        next STHING;
                    }
                }
            }
        } elsif ($meth eq "ls") {
            $self-&gt;globls($s,\@pragma);
            next STHING;
        } else {
            CPAN-&gt;debug("calling expandany [$s]") if $CPAN::DEBUG;
            $obj = CPAN::Shell-&gt;expandany($s);
        }
        if (0) {
        } elsif (ref $obj) {
            if ($meth =~ /^($needs_recursion_protection)$/) {
                # it would be silly to check for recursion for look or dump
                # (we are in CPAN::Shell::rematein)
                CPAN-&gt;debug("Going to test against recursion") if $CPAN::DEBUG;
                eval {  $obj-&gt;color_cmd_tmps(0,1); };
                if ($@) {
                    if (ref $@
                        and $@-&gt;isa("CPAN::Exception::RecursiveDependency")) {
                        $CPAN::Frontend-&gt;mywarn($@);
                    } else {
                        if (0) {
                            require Carp;
                            Carp::confess(sprintf "DEBUG: \$\@[%s]ref[%s]", $@, ref $@);
                        }
                        die;
                    }
                }
            }
            CPAN::Queue-&gt;queue_item(qmod =&gt; $obj-&gt;id, reqtype =&gt; "c");
            push @qcopy, $obj;
        } elsif ($CPAN::META-&gt;exists('CPAN::Author',uc($s))) {
            $obj = $CPAN::META-&gt;instance('CPAN::Author',uc($s));
            if ($meth =~ /^(dump|ls|reports)$/) {
                $obj-&gt;$meth();
            } else {
                $CPAN::Frontend-&gt;mywarn(
                                        join "",
                                        "Don't be silly, you can't $meth ",
                                        $obj-&gt;fullname,
                                        " ;-)\n"
                                       );
                $CPAN::Frontend-&gt;mysleep(2);
            }
        } elsif ($s =~ m|[\$\@\%]| &amp;&amp; $meth eq "dump") {
            CPAN::InfoObj-&gt;dump($s);
        } else {
            $CPAN::Frontend
                -&gt;mywarn(qq{Warning: Cannot $meth $s, }.
                         qq{don't know what it is.
Try the command

    i /$s/

to find objects with matching identifiers.
});
            $CPAN::Frontend-&gt;mysleep(2);
        }
    }

    # queuerunner (please be warned: when I started to change the
    # queue to hold objects instead of names, I made one or two
    # mistakes and never found which. I reverted back instead)
  QITEM: while (my $q = CPAN::Queue-&gt;first) {
        my $obj;
        my $s = $q-&gt;as_string;
        my $reqtype = $q-&gt;reqtype || "";
        $obj = CPAN::Shell-&gt;expandany($s);
        unless ($obj) {
            # don't know how this can happen, maybe we should panic,
            # but maybe we get a solution from the first user who hits
            # this unfortunate exception?
            $CPAN::Frontend-&gt;mywarn("Warning: Could not expand string '$s' ".
                                    "to an object. Skipping.\n");
            $CPAN::Frontend-&gt;mysleep(5);
            CPAN::Queue-&gt;delete_first($s);
            next QITEM;
        }
        $obj-&gt;{reqtype} ||= "";
        {
            # force debugging because CPAN::SQLite somehow delivers us
            # an empty object;

            # local $CPAN::DEBUG = 1024; # Shell; probably fixed now

            CPAN-&gt;debug("s[$s]obj-reqtype[$obj-&gt;{reqtype}]".
                        "q-reqtype[$reqtype]") if $CPAN::DEBUG;
        }
        if ($obj-&gt;{reqtype}) {
            if ($obj-&gt;{reqtype} eq "b" &amp;&amp; $reqtype =~ /^[rc]$/) {
                $obj-&gt;{reqtype} = $reqtype;
                if (
                    exists $obj-&gt;{install}
                    &amp;&amp;
                    (
                     UNIVERSAL::can($obj-&gt;{install},"failed") ?
                     $obj-&gt;{install}-&gt;failed :
                     $obj-&gt;{install} =~ /^NO/
                    )
                   ) {
                    delete $obj-&gt;{install};
                    $CPAN::Frontend-&gt;mywarn
                        ("Promoting $obj-&gt;{ID} from 'build_requires' to 'requires'");
                }
            }
        } else {
            $obj-&gt;{reqtype} = $reqtype;
        }

        for my $pragma (@pragma) {
            if ($pragma
                &amp;&amp;
                $obj-&gt;can($pragma)) {
                $obj-&gt;$pragma($meth);
            }
        }
        if (UNIVERSAL::can($obj, 'called_for')) {
            $obj-&gt;called_for($s);
        }
        CPAN-&gt;debug(qq{pragma[@pragma]meth[$meth]}.
                    qq{ID[$obj-&gt;{ID}]}) if $CPAN::DEBUG;

        push @qcopy, $obj;
        if ($meth =~ /^(report)$/) { # they came here with a pragma?
            $self-&gt;$meth($obj);
        } elsif (! UNIVERSAL::can($obj,$meth)) {
            # Must never happen
            my $serialized = "";
            if (0) {
            } elsif ($CPAN::META-&gt;has_inst("YAML::Syck")) {
                $serialized = YAML::Syck::Dump($obj);
            } elsif ($CPAN::META-&gt;has_inst("YAML")) {
                $serialized = YAML::Dump($obj);
            } elsif ($CPAN::META-&gt;has_inst("Data::Dumper")) {
                $serialized = Data::Dumper::Dumper($obj);
            } else {
                require overload;
                $serialized = overload::StrVal($obj);
            }
            CPAN-&gt;debug("Going to panic. meth[$meth]s[$s]") if $CPAN::DEBUG;
            $CPAN::Frontend-&gt;mydie("Panic: obj[$serialized] cannot meth[$meth]");
        } elsif ($obj-&gt;$meth()) {
            CPAN::Queue-&gt;delete($s);
            CPAN-&gt;debug("From queue deleted. meth[$meth]s[$s]") if $CPAN::DEBUG;
        } else {
            CPAN-&gt;debug("Failed. pragma[@pragma]meth[$meth]") if $CPAN::DEBUG;
        }

        $obj-&gt;undelay;
        for my $pragma (@pragma) {
            my $unpragma = "un$pragma";
            if ($obj-&gt;can($unpragma)) {
                $obj-&gt;$unpragma();
            }
        }
        if ($CPAN::Config-&gt;{halt_on_failure}
                &amp;&amp;
                    CPAN::Distrostatus::something_has_just_failed()
              ) {
            $CPAN::Frontend-&gt;mywarn("Stopping: '$meth' failed for '$s'.\n");
            CPAN::Queue-&gt;nullify_queue;
            last QITEM;
        }
        CPAN::Queue-&gt;delete_first($s);
    }
    if ($meth =~ /^($needs_recursion_protection)$/) {
        for my $obj (@qcopy) {
            $obj-&gt;color_cmd_tmps(0,0);
        }
    }
}

#-&gt; sub CPAN::Shell::recent ;
sub recent {
  my($self) = @_;
  if ($CPAN::META-&gt;has_inst("XML::LibXML")) {
      my $url = $CPAN::Defaultrecent;
      $CPAN::Frontend-&gt;myprint("Going to fetch '$url'\n");
      unless ($CPAN::META-&gt;has_usable("LWP")) {
          $CPAN::Frontend-&gt;mydie("LWP not installed; cannot continue");
      }
      CPAN::LWP::UserAgent-&gt;config;
      my $Ua;
      eval { $Ua = CPAN::LWP::UserAgent-&gt;new; };
      if ($@) {
          $CPAN::Frontend-&gt;mydie("CPAN::LWP::UserAgent-&gt;new dies with $@\n");
      }
      my $resp = $Ua-&gt;get($url);
      unless ($resp-&gt;is_success) {
          $CPAN::Frontend-&gt;mydie(sprintf "Could not download '%s': %s\n", $url, $resp-&gt;code);
      }
      $CPAN::Frontend-&gt;myprint("DONE\n\n");
      my $xml = XML::LibXML-&gt;new-&gt;parse_string($resp-&gt;content);
      if (0) {
          my $s = $xml-&gt;serialize(2);
          $s =~ s/\n\s*\n/\n/g;
          $CPAN::Frontend-&gt;myprint($s);
          return;
      }
      my @distros;
      if ($url =~ /winnipeg/) {
          my $pubdate = $xml-&gt;findvalue("/rss/channel/pubDate");
          $CPAN::Frontend-&gt;myprint("    pubDate: $pubdate\n\n");
          for my $eitem ($xml-&gt;findnodes("/rss/channel/item")) {
              my $distro = $eitem-&gt;findvalue("enclosure/\@url");
              $distro =~ s|.*?/authors/id/./../||;
              my $size   = $eitem-&gt;findvalue("enclosure/\@length");
              my $desc   = $eitem-&gt;findvalue("description");
              $desc =~ s/.+? - //;
              $CPAN::Frontend-&gt;myprint("$distro [$size b]\n    $desc\n");
              push @distros, $distro;
          }
      } elsif ($url =~ /search.*uploads.rdf/) {
          # xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
          # xmlns="http://purl.org/rss/1.0/"
          # xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/"
          # xmlns:dc="http://purl.org/dc/elements/1.1/"
          # xmlns:syn="http://purl.org/rss/1.0/modules/syndication/"
          # xmlns:admin="http://webns.net/mvcb/"


          my $dc_date = $xml-&gt;findvalue("//*[local-name(.) = 'RDF']/*[local-name(.) = 'channel']/*[local-name(.) = 'date']");
          $CPAN::Frontend-&gt;myprint("    dc:date: $dc_date\n\n");
          my $finish_eitem = 0;
          local $SIG{INT} = sub { $finish_eitem = 1 };
        EITEM: for my $eitem ($xml-&gt;findnodes("//*[local-name(.) = 'RDF']/*[local-name(.) = 'item']")) {
              my $distro = $eitem-&gt;findvalue("\@rdf:about");
              $distro =~ s|.*~||; # remove up to the tilde before the name
              $distro =~ s|/$||; # remove trailing slash
              $distro =~ s|([^/]+)|\U$1\E|; # upcase the name
              my $author = uc $1 or die "distro[$distro] without author, cannot continue";
              my $desc   = $eitem-&gt;findvalue("*[local-name(.) = 'description']");
              my $i = 0;
            SUBDIRTEST: while () {
                  last SUBDIRTEST if ++$i &gt;= 6; # half a dozen must do!
                  if (my @ret = $self-&gt;globls("$distro*")) {
                      @ret = grep {$_-&gt;[2] !~ /meta/} @ret;
                      @ret = grep {length $_-&gt;[2]} @ret;
                      if (@ret) {
                          $distro = "$author/$ret[0][2]";
                          last SUBDIRTEST;
                      }
                  }
                  $distro =~ s|/|/*/|; # allow it to reside in a subdirectory
              }

              next EITEM if $distro =~ m|\*|; # did not find the thing
              $CPAN::Frontend-&gt;myprint("____$desc\n");
              push @distros, $distro;
              last EITEM if $finish_eitem;
          }
      }
      return \@distros;
  } else {
      # deprecated old version
      $CPAN::Frontend-&gt;mydie("no XML::LibXML installed, cannot continue\n");
  }
}

#-&gt; sub CPAN::Shell::smoke ;
sub smoke {
    my($self) = @_;
    my $distros = $self-&gt;recent;
  DISTRO: for my $distro (@$distros) {
        next if $distro =~ m|/Bundle-|; # XXX crude heuristic to skip bundles
        $CPAN::Frontend-&gt;myprint(sprintf "Going to download and test '$distro'\n");
        {
            my $skip = 0;
            local $SIG{INT} = sub { $skip = 1 };
            for (0..9) {
                $CPAN::Frontend-&gt;myprint(sprintf "\r%2d (Hit ^C to skip)", 10-$_);
                sleep 1;
                if ($skip) {
                    $CPAN::Frontend-&gt;myprint(" skipped\n");
                    next DISTRO;
                }
            }
        }
        $CPAN::Frontend-&gt;myprint("\r  \n"); # leave the dirty line with a newline
        $self-&gt;test($distro);
    }
}

{
    # set up the dispatching methods
    no strict "refs";
    for my $command (qw(
                        clean
                        cvs_import
                        dump
                        force
                        fforce
                        get
                        install
                        look
                        ls
                        make
                        notest
                        perldoc
                        readme
                        reports
                        test
                       )) {
        *$command = sub { shift-&gt;rematein($command, @_); };
    }
}

1;
</pre></body></html>