X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCPAN%2FFirstTime.pm;h=289984956c0681132006cbc772c389d5200d5503;hb=c9d9b47338546ba1896637d2b0c054dc47bef6ef;hp=0d32a23c0624536281ea1aff0cad9753d12727b2;hpb=f14b5cec44a20371f37547f211a9de1d22dda6cb;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/CPAN/FirstTime.pm b/lib/CPAN/FirstTime.pm index 0d32a23..2899849 100644 --- a/lib/CPAN/FirstTime.pm +++ b/lib/CPAN/FirstTime.pm @@ -16,7 +16,7 @@ use FileHandle (); use File::Basename (); use File::Path (); use vars qw($VERSION); -$VERSION = substr q$Revision: 1.35 $, 10; +$VERSION = substr q$Revision: 1.37 $, 10; =head1 NAME @@ -77,7 +77,9 @@ dialog anytime later by typing 'o conf init' at the cpan prompt.) *prompt = \&ExtUtils::MakeMaker::prompt; } else { $fastread = 1; - *prompt = sub { + $CPAN::Config->{urllist} ||= []; + # prototype should match that of &MakeMaker::prompt + *prompt = sub ($;$) { my($q,$a) = @_; my($ret) = defined $a ? $a : ""; printf qq{%s [%s]\n\n}, $q, $ret; @@ -113,13 +115,18 @@ First of all, I\'d like to create this directory. Where? $default = $cpan_home; while ($ans = prompt("CPAN build and cache directory?",$default)) { - File::Path::mkpath($ans); # dies if it can't - if (-d $ans && -w _) { - last; - } else { - warn "Couldn't find directory $ans + eval { File::Path::mkpath($ans); }; # dies if it can't + if ($@) { + warn "Couldn't create directory $ans. +Please retry.\n"; + next; + } + if (-d $ans && -w _) { + last; + } else { + warn "Couldn't find directory $ans or directory is not writable. Please retry.\n"; - } + } } $CPAN::Config->{cpan_home} = $ans; @@ -353,16 +360,25 @@ sub conf_sites { require File::Copy; File::Copy::copy($m,$mby) or die "Could not update $mby: $!"; } - if ( ! -f $mby ){ - print qq{You have no $mby + while () { + if ( ! -f $mby ){ + print qq{You have no $mby I\'m trying to fetch one }; - $mby = CPAN::FTP->localize($m,$mby,3); - } elsif (-M $mby > 30 ) { - print qq{Your $mby is older than 30 days, + $mby = CPAN::FTP->localize($m,$mby,3); + } elsif (-M $mby > 30 ) { + print qq{Your $mby is older than 30 days, I\'m trying to fetch one }; - $mby = CPAN::FTP->localize($m,$mby,3); + $mby = CPAN::FTP->localize($m,$mby,3); + } elsif (-s $mby == 0) { + print qq{You have an empty $mby, + I\'m trying to fetch one +}; + $mby = CPAN::FTP->localize($m,$mby,3); + } else { + last; + } } read_mirrored_by($mby); }