use FileHandle ();
use File::Path ();
use vars qw($VERSION);
-$VERSION = substr q$Revision: 1.18 $, 10;
+$VERSION = substr q$Revision: 1.21 $, 10;
=head1 NAME
$CPAN::Config ||= {};
local($/) = "\n";
local($\) = "";
+ local($|) = 1;
my($ans,$default,$local,$cont,$url,$expected_size);
};
- my(@path) = split($Config{path_sep},$ENV{PATH});
+ my(@path) = split /$Config{'path_sep'}/, $ENV{'PATH'};
my $prog;
for $prog (qw/gzip tar unzip make lynx ncftp ftp/){
- my $path = $CPAN::Config->{$prog} || find_exe($prog,[@path]) || $prog;
+ my $path = $CPAN::Config->{$prog} || "";
+ if (MM->file_name_is_absolute($path)) {
+ warn "Warning: configured $path does not exist\n" unless -e $path;
+ $path = "";
+ } else {
+ $path = '';
+ }
+ $path ||= find_exe($prog,[@path]);
+ warn "Warning: $prog not found in PATH\n" unless -e $path;
$ans = prompt("Where is your $prog program?",$path) || $path;
$CPAN::Config->{$prog} = $ans;
}
my $path = $CPAN::Config->{'pager'} ||
$ENV{PAGER} || find_exe("less",[@path]) ||
find_exe("more",[@path]) || "more";
- $ans = prompt("What is your favorite pager program?",$path) || $path;
+ $ans = prompt("What is your favorite pager program?",$path);
$CPAN::Config->{'pager'} = $ans;
- $path = $CPAN::Config->{'shell'} || $ENV{SHELL} || "";
- $ans = prompt("What is your favorite shell?",$path) || $path;
+ $path = $CPAN::Config->{'shell'};
+ if (MM->file_name_is_absolute($path)) {
+ warn "Warning: configured $path does not exist\n" unless -e $path;
+ $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;
#
$default = $CPAN::Config->{inactivity_timeout} || 0;
$CPAN::Config->{inactivity_timeout} =
- prompt("Timout for inacivity during Makefile.PL?",$default);
+ prompt("Timeout for inacivity during Makefile.PL?",$default);
#
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' 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{
sub find_exe {
my($exe,$path) = @_;
- my($dir,$MY);
- $MY = {};
- bless $MY, 'MY';
+ my($dir);
+ #warn "in find_exe exe[$exe] path[@$path]";
for $dir (@$path) {
- my $abs = $MY->catfile($dir,$exe);
- if ($MY->maybe_command($abs)) {
+ my $abs = MM->catfile($dir,$exe);
+ if (($abs = MM->maybe_command($abs))) {
return $abs;
}
}