$matcher = "\\b(".join("|",@{$args{args}}).")\\b";
}
CPAN->debug("matcher[$matcher]") if $CPAN::DEBUG;
unless ($CPAN::VERSION) {
require CPAN::Nox;
}
require CPAN::HandleConfig;
CPAN::HandleConfig::require_myconfig_or_config();
$CPAN::Config ||= {};
local($/) = "\n";
local($\) = "";
local($|) = 1;
my($ans,$default);
#
#= Files, directories
#
unless ($matcher) {
$CPAN::Frontend->myprint($prompts{manual_config});
}
my $manual_conf;
local *_real_prompt;
if ( $args{autoconfig} ) {
$manual_conf = "no";
} elsif ($matcher) {
$manual_conf = "yes";
} else {
my $_conf = prompt("Would you like me to configure as much as possible ".
"automatically?", "yes");
$manual_conf = ($_conf and $_conf =~ /^y/i) ? "no" : "yes";
}
CPAN->debug("manual_conf[$manual_conf]") if $CPAN::DEBUG;
my $fastread;
{
if ($manual_conf =~ /^y/i) {
$fastread = 0;
} else {
$fastread = 1;
$CPAN::Config->{urllist} ||= [];
local $^W = 0;
# prototype should match that of &MakeMaker::prompt
my $current_second = time;
my $current_second_count = 0;
my $i_am_mad = 0;
*_real_prompt = sub {
my($q,$a) = @_;
my($ret) = defined $a ? $a : "";
$CPAN::Frontend->myprint(sprintf qq{%s [%s]\n\n}, $q, $ret);
eval { require Time::HiRes };
unless ($@) {
if (time == $current_second) {
$current_second_count++;
if ($current_second_count > 20) {
# I don't like more than 20 prompts per second
$i_am_mad++;
}
} else {
$current_second = time;
$current_second_count = 0;
$i_am_mad-- if $i_am_mad>0;
}
if ($i_am_mad>0) {
#require Carp;
#Carp::cluck("SLEEEEEEEEPIIIIIIIIIIINGGGGGGGGGGG");
Time::HiRes::sleep(0.1);
}
}
$ret;
};
}
}
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/) {
my $cpan_home = $CPAN::Config->{cpan_home}
|| File::Spec->catdir(CPAN::HandleConfig::home(), ".cpan");
if (-d $cpan_home) {
$CPAN::Frontend->myprint(qq{
I see you already have a directory
$cpan_home
Shall we use it as the general CPAN build and cache directory?
});
} else {
=7= |