$CPAN::Config ||= {};
local($/) = "\n";
local($\) = "";
+ local($|) = 1;
my($ans,$default,$local,$cont,$url,$expected_size);
$path = "";
}
$path ||= $ENV{SHELL};
+ $path =~ s,\\,/,g if $^O eq 'os2'; # Cosmetic only
$ans = prompt("What is your favorite shell?",$path);
$CPAN::Config->{'shell'} = $ans;
if (@{$CPAN::Config->{urllist}||[]}) {
print qq{
I found a list of URLs in CPAN::Config and will use this.
-You can change it later with the 'o conf urllist' command.
+You can change it later from CPAN shell with the 'o conf urllist' command.
}
} elsif (
read_mirrored_by($local);
} else {
$CPAN::Config->{urllist} ||= [];
+ my $val = 'http://this.field.should.be.inserted/';
+ my $cnt = 0;
while (! @{$CPAN::Config->{urllist}}) {
my($input) = prompt(qq{
-We need to know the URL of your favorite CPAN site.
-Please enter it here:});
+We need to know the URL of your favorite CPAN site. Any one will go,
+you can change it later from CPAN shell with the 'o conf urllist' command.
+A short list is available in 'perlmodlib', as in
+ perldoc perlmodlib
+Please enter it here:}, $val);
$input =~ s/\s//g;
+ die "Did not obtain required field" if $cnt > 10;
+ $cnt++, next if $input eq $val;
next unless $input;
my($wanted) = "MIRRORED.BY";
print qq{
#warn "in find_exe exe[$exe] path[@$path]";
for $dir (@$path) {
my $abs = MM->catfile($dir,$exe);
- if (MM->maybe_command($abs)) {
+ if (($abs = MM->maybe_command($abs))) {
return $abs;
}
}
sub prompt ($;$) {
my($mess,$def)=@_;
- $ISA_TTY = -t STDIN && -t STDOUT ;
+ $ISA_TTY = -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT)) ; # Pipe?
Carp::confess("prompt function called without an argument") unless defined $mess;
my $dispdef = defined $def ? "[$def] " : " ";
$def = defined $def ? $def : "";
my $ans;
+ local $|=1;
+ print "$mess $dispdef";
if ($ISA_TTY) {
- local $|=1;
- print "$mess $dispdef";
chomp($ans = <STDIN>);
+ } else {
+ print "$def\n";
}
return $ans || $def;
}