package CPAN::Mirrored::By;
use strict;
-sub new {
+sub new {
my($self,@arg) = @_;
bless [@arg], $self;
}
use File::Path ();
use File::Spec ();
use vars qw($VERSION $urllist);
-$VERSION = sprintf "%.6f", substr(q$Rev: 1086 $,4)/1000000 + 5.4;
+$VERSION = sprintf "%.6f", substr(q$Rev: 1379 $,4)/1000000 + 5.4;
=head1 NAME
# case WORD... => all arguments must be valid
for my $arg (@{$args{args}}) {
unless (exists $CPAN::HandleConfig::keys{$arg}) {
- $CPAN::Frontend->mywarn("'$arg' is not a valid configuration variable");
+ $CPAN::Frontend->mywarn("'$arg' is not a valid configuration variable\n");
return;
}
}
my $current_second = time;
my $current_second_count = 0;
my $i_am_mad = 0;
- *_real_prompt = sub ($;$) {
+ *_real_prompt = sub {
my($q,$a) = @_;
my($ret) = defined $a ? $a : "";
$CPAN::Frontend->myprint(sprintf qq{%s [%s]\n\n}, $q, $ret);
}
}
- if (!$matcher or 'cpan_home keep_source_where build_dir prefs_dir' =~ /$matcher/){
+ if (!$matcher or q{
+ build_dir
+ build_dir_reuse
+ cpan_home
+ keep_source_where
+ prefs_dir
+ } =~ /$matcher/){
$CPAN::Frontend->myprint($prompts{config_intro});
if (!$matcher or 'cpan_home' =~ /$matcher/) {
$default = $cpan_home;
my $loop = 0;
- while ($ans = prompt("CPAN build and cache directory?",$default)) {
- unless (File::Spec->file_name_is_absolute($ans)) {
+ my $last_ans;
+ PROMPT: while ($ans = prompt("CPAN build and cache directory?",$default)) {
+ if (File::Spec->file_name_is_absolute($ans)) {
+ my @cpan_home = split /[\/\\]/, $ans;
+ DIR: for my $dir (@cpan_home) {
+ if ($dir =~ /^~/ and (!$last_ans or $ans ne $last_ans)) {
+ $CPAN::Frontend
+ ->mywarn("Warning: a tilde in the path will be ".
+ "taken as a literal tilde. Please ".
+ "confirm again if you want to keep it\n");
+ $last_ans = $default = $ans;
+ next PROMPT;
+ }
+ }
+ } else {
require Cwd;
my $cwd = Cwd::cwd();
my $absans = File::Spec->catdir($cwd,$ans);
);
}
+ if (!$matcher or 'build_dir_reuse' =~ /$matcher/) {
+ my_yn_prompt(build_dir_reuse => "y", $matcher);
+ }
+
if (!$matcher or 'prefs_dir' =~ /$matcher/) {
my_dflt_prompt("prefs_dir",
File::Spec->catdir($CPAN::Config->{cpan_home},"prefs"),
#
my_yn_prompt(cache_metadata => 1, $matcher);
+ my_yn_prompt(use_sqlite => 0, $matcher);
#
#= Do we follow PREREQ_PM?
*_real_prompt = \&CPAN::Shell::colorable_makemaker_prompt;
conf_sites();
}
+ if ("randomize_urllist" =~ $matcher) {
+ my_dflt_prompt(randomize_urllist => 0, $matcher);
+ }
} elsif ($fastread) {
$CPAN::Frontend->myprint("Autoconfigured everything but 'urllist'.\n".
"Please call 'o conf init urllist' to configure ".
"Directory where the build process takes place?",
+build_dir_reuse_intro =>
+
+qq{Until version 1.88 CPAN.pm never trusted the contents of the
+build_dir directory between sessions. Since 1.88_58 CPAN.pm has a
+YAML-based mechanism that makes it possible to share the contents of
+the build_dir/ directory between different sessions with the same
+version of perl. People who prefer to test things several days before
+installing will like this feature because it safes a lot of time.
+
+If you say yes to the following question, CPAN will try to store
+enough information about the build process so that it can pick up in
+future sessions at the same state of affairs as it left a previous
+session.
+
+},
+
+build_dir_reuse =>
+
+qq{Store and re-use state information about distributions between
+CPAN.pm sessions?},
+
prefs_dir_intro => qq{
CPAN.pm can store customized build environments based on regular
possible to use Storable to create a cache of metadata. If Storable
is not available, the normal index mechanism will be used.
+Note: this mechanism is not used when use_sqlite is on and SQLLite is
+running.
+
},
cache_metadata => qq{Cache metadata (yes/no)?},
+use_sqlite_intro => qq{
+
+CPAN::SQLite is a layer between the index files that are downloaded
+from the CPAN and CPAN.pm that speeds up metadata queries and reduces
+memory consumption of CPAN.pm considereably.
+
+},
+
+use_sqlite => qq{Use CPAN::SQLite if available? (yes/no)?},
+
term_is_latin_intro => qq{
The next option deals with the charset (aka character set) your
yaml_module => qq{Which YAML implementation would you prefer?},
+randomize_urllist_intro => qq{
+
+CPAN.pm can introduce some randomness when using hosts for download
+that are configured in the urllist parameter. Enter a numeric value
+between 0 and 1 to indicate how often you want to let CPAN.pm try a
+random host from the urllist. A value of one specifies to always use a
+random host as the first try. A value of zero means no randomness at
+all. Anything in between specifies how often, on average, a random
+host should be tried first.
+
+},
+
+randomize_urllist => "Randomize parameter",
+
);
die "Coding error in \@prompts declaration. Odd number of elements, above"