use File::Basename ();
use File::Path ();
use vars qw($VERSION);
-$VERSION = substr q$Revision: 1.38 $, 10;
+$VERSION = substr q$Revision: 1.46 $, 10;
=head1 NAME
print qq{
How big should the disk cache be for keeping the build directories
-with all the intermediate files?
+with all the intermediate files\?
};
} while ($ans ne 'atstart' && $ans ne 'never');
$CPAN::Config->{scan_cache} = $ans;
+ print qq{
+
+To considerably speed up the initial CPAN shell startup, it is
+possible to use Storable to create a cache of metadata. If Storable
+is not available, the normal index mechanism will be used.
+
+};
+
+ defined($default = $CPAN::Config->{cache_metadata}) or $default = 1;
+ do {
+ $ans = prompt("Cache metadata (yes/no)?", ($default ? 'yes' : 'no'));
+ } while ($ans !~ /^\s*[yn]/i);
+ $CPAN::Config->{cache_metadata} = ($ans =~ /^\s*y/i ? 1 : 0);
+
#
# prerequisites_policy
# Do we follow PREREQ_PM?
};
- $default = $CPAN::Config->{prerequisites_policy} || 'follow';
+ $default = $CPAN::Config->{prerequisites_policy} || 'ask';
do {
$ans =
prompt("Policy on building prerequisites (follow, ask or ignore)?",
File::Copy::copy($m,$mby) or die "Could not update $mby: $!";
}
my $loopcount = 0;
- while () {
+ local $^T = time;
+ while ($mby) {
if ( ! -f $mby ){
print qq{You have no $mby
I\'m trying to fetch one
}
}
read_mirrored_by($mby);
+ bring_your_own();
}
sub find_exe {
}
sub read_mirrored_by {
- my($local) = @_;
+ my $local = shift or return;
my(%all,$url,$expected_size,$default,$ans,$host,$dst,$country,$continent,@location);
my $fh = FileHandle->new;
$fh->open($local) or die "Couldn't open $local: $!";
@urls = picklist (\@urls, $prompt, $default);
foreach (@urls) { s/ \(.*\)//; }
- %seen = map (($_ => 1), @urls);
+ push @{$CPAN::Config->{urllist}}, @urls;
+}
+sub bring_your_own {
+ my %seen = map (($_ => 1), @{$CPAN::Config->{urllist}});
+ my($ans,@urls);
do {
- $ans = prompt ("Enter another URL or RETURN to quit:", "");
+ my $prompt = "Enter another URL or RETURN to quit:";
+ unless (%seen) {
+ $prompt = qq{CPAN.pm needs at least one URL where it can fetch CPAN files from.
+
+Please enter your CPAN site:};
+ }
+ $ans = prompt ($prompt, "");
if ($ans) {
- $ans =~ s|/?$|/|; # has to end with one slash
+ $ans =~ s|/?\z|/|; # has to end with one slash
$ans = "file:$ans" unless $ans =~ /:/; # without a scheme is a file:
if ($ans =~ /^\w+:\/./) {
- push @urls, $ans
- unless $seen{$ans};
- }
- else {
+ push @urls, $ans unless $seen{$ans}++;
+ } else {
print qq{"$ans" doesn\'t look like an URL at first sight.
I\'ll ignore it for now. You can add it to $INC{'CPAN/MyConfig.pm'}
later if you\'re sure it\'s right.\n};
}
}
- } while $ans;
+ } while $ans || !%seen;
push @{$CPAN::Config->{urllist}}, @urls;
# xxx delete or comment these out when you're happy that it works