From: Andreas König Date: Thu, 2 Feb 2006 12:35:41 +0000 (+0100) Subject: [PAUSE] CPAN Upload: A/AN/ANDK/CPAN-1.83_64.tar.gz X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=44d211041aaa1e1b93ed2c7ae6ca80132bb688b9;p=p5sagit%2Fp5-mst-13.2.git [PAUSE] CPAN Upload: A/AN/ANDK/CPAN-1.83_64.tar.gz Message-ID: <87acda0z8y.fsf@k75.linux.bogus> p4raw-id: //depot/perl@27062 --- diff --git a/lib/CPAN.pm b/lib/CPAN.pm index 797ecf3..77fe51c 100644 --- a/lib/CPAN.pm +++ b/lib/CPAN.pm @@ -1,5 +1,6 @@ +# -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- package CPAN; -$VERSION = '1.83_59'; +$VERSION = '1.83_64'; $VERSION = eval $VERSION; use strict; @@ -51,10 +52,26 @@ use vars qw($VERSION @EXPORT $AUTOLOAD $DEBUG $META $HAS_USABLE $term @CPAN::ISA = qw(CPAN::Debug Exporter); +# note that these functions live in CPAN::Shell and get executed via +# AUTOLOAD when called directly @EXPORT = qw( - autobundle bundle expand force notest get cvs_import - install make readme recompile shell test clean - perldoc recent + autobundle + bundle + clean + cvs_import + expand + force + get + install + make + mkmyconfig + notest + perldoc + readme + recent + recompile + shell + test ); sub soft_chdir_with_alternatives ($); @@ -238,6 +255,7 @@ Trying to chdir to "$cwd->[1]" instead. } } } + package CPAN::CacheMgr; use strict; @CPAN::CacheMgr::ISA = qw(CPAN::InfoObj CPAN); @@ -245,7 +263,7 @@ use File::Find; package CPAN::FTP; use strict; -use vars qw($Ua $Thesite $Themethod); +use vars qw($Ua $Thesite $ThesiteURL $Themethod); @CPAN::FTP::ISA = qw(CPAN::Debug); package CPAN::LWP::UserAgent; @@ -266,12 +284,15 @@ use strict; install look ls - make test + make + mkmyconfig notest perldoc readme recent + recompile reload + test ); package CPAN::Index; @@ -653,7 +674,7 @@ Please make sure the directory exists and is writable. }; $CPAN::Frontend->mydie($diemess); } - } + } # $@ after eval mkpath $dotcpan my $fh; unless ($fh = FileHandle->new(">$lockfile")) { if ($! =~ /Permission/) { @@ -675,8 +696,18 @@ this variable in either $incc or $myincc - }); + if(!$INC{'CPAN/MyConfig.pm'}) { + $CPAN::Frontend->myprint("You don't seem to have a user ". + "configuration (MyConfig.pm) yet.\n"); + my $new = ExtUtils::MakeMaker::prompt("Do you want to create a ". + "user configuration now? (Y/n)", + "yes"); + if($new =~ m{^y}i) { + CPAN::Shell->mkmyconfig(); + return &checklock; + } + } } $CPAN::Frontend->mydie("Could not open >$lockfile: $!"); } @@ -1523,6 +1554,26 @@ sub reload_this { return 1; } +#-> sub CPAN::Shell::mkmyconfig ; +sub mkmyconfig { + my($self, $cpanpm, %args) = @_; + require CPAN::FirstTime; + $cpanpm = $INC{'CPAN/MyConfig.pm'} || "$ENV{HOME}/.cpan/CPAN/MyConfig.pm"; + File::Path::mkpath(File::Basename::dirname($cpanpm)) unless -e $cpanpm; + if(!$INC{'CPAN/Config.pm'}) { + eval { require CPAN::Config; }; + } + $CPAN::Config ||= {}; + $CPAN::Config = { + %$CPAN::Config, + build_dir => undef, + cpan_home => undef, + keep_source_where => undef, + histfile => undef, + }; + CPAN::FirstTime::init($cpanpm, %args); +} + #-> sub CPAN::Shell::_binary_extensions ; sub _binary_extensions { my($self) = shift @_; @@ -1704,22 +1755,42 @@ sub failed { my $failed = ""; for my $nosayer (qw(signature_verify make make_test install)) { next unless exists $d->{$nosayer}; - next unless $d->{$nosayer}->failed; + next unless ( + $d->{$nosayer}->can("failed") ? + $d->{$nosayer}->failed : + $d->{$nosayer} =~ /^NO/ + ); $failed = $nosayer; last; } next DIST unless $failed; - next DIST if $only_id && $only_id != $d->{$failed}->commandid; + next DIST if $only_id && $only_id != ( + $d->{$failed}->can("commandid") + ? + $d->{$failed}->commandid + : + $CPAN::CurrentCommandId + ); my $id = $d->id; $id =~ s|^./../||; #$print .= sprintf( # " %-45s: %s %s\n", - push @failed, [ - $d->{$failed}->commandid, - $id, - $failed, - $d->{$failed}->text, - ]; + push @failed, + ( + $d->{$failed}->can("failed") ? + [ + $d->{$failed}->commandid, + $id, + $failed, + $d->{$failed}->text, + ] : + [ + 1, + $id, + $failed, + $d->{$failed}, + ] + ); } my $scope = $only_id ? "command" : "session"; if (@failed) { @@ -2506,11 +2577,11 @@ sub localize { <=> (substr($CPAN::Config->{urllist}[$a],0,4) eq "file") or - defined($Thesite) + defined($ThesiteURL) and - ($CPAN::Config->{urllist}[$b] eq $Thesite) + ($CPAN::Config->{urllist}[$b] eq $ThesiteURL) <=> - ($CPAN::Config->{urllist}[$a] eq $Thesite) + ($CPAN::Config->{urllist}[$a] eq $ThesiteURL) } 0..$last; } my(@levels); @@ -2594,7 +2665,7 @@ sub hosteasy { $self->debug("without URI::URL we try local file $l") if $CPAN::DEBUG; } if ( -f $l && -r _) { - $Thesite = $ro_url; + $ThesiteURL = $ro_url; return $l; } # Maybe mirror has compressed it? @@ -2602,7 +2673,7 @@ sub hosteasy { $self->debug("found compressed $l.gz") if $CPAN::DEBUG; CPAN::Tarzip->new("$l.gz")->gunzip($aslocal); if ( -f $aslocal) { - $Thesite = $ro_url; + $ThesiteURL = $ro_url; return $aslocal; } } @@ -2620,7 +2691,7 @@ sub hosteasy { } my $res = $Ua->mirror($url, $aslocal); if ($res->is_success) { - $Thesite = $ro_url; + $ThesiteURL = $ro_url; my $now = time; utime $now, $now, $aslocal; # download time is more # important than upload time @@ -2634,7 +2705,7 @@ sub hosteasy { if ($res->is_success && CPAN::Tarzip->new("$aslocal.gz")->gunzip($aslocal) ) { - $Thesite = $ro_url; + $ThesiteURL = $ro_url; return $aslocal; } } else { @@ -2662,7 +2733,7 @@ sub hosteasy { $self->debug("getfile[$getfile]dir[$dir]host[$host]" . "aslocal[$aslocal]") if $CPAN::DEBUG; if (CPAN::FTP->ftp_get($host,$dir,$getfile,$aslocal)) { - $Thesite = $ro_url; + $ThesiteURL = $ro_url; return $aslocal; } if ($aslocal !~ /\.gz(?!\n)\Z/) { @@ -2676,7 +2747,7 @@ sub hosteasy { $gz) && CPAN::Tarzip->new($gz)->gunzip($aslocal) ){ - $Thesite = $ro_url; + $ThesiteURL = $ro_url; return $aslocal; } } @@ -2720,7 +2791,7 @@ sub hosthard { # Try the most capable first and leave ncftp* for last as it only # does FTP. - for my $f (qw(curl wget lynx ncftpget ncftp)) { + DLPRG: for my $f (qw(curl wget lynx ncftpget ncftp)) { my $funkyftp = $CPAN::Config->{$f}; next unless defined $funkyftp; next if $funkyftp =~ /^\s*$/; @@ -2740,7 +2811,7 @@ sub hosthard { $src_switch = " -O $asl_ungz"; $stdout_redir = ""; } elsif ($f eq 'curl'){ - $src_switch = ' -L'; + $src_switch = ' -L -f -s -S --netrc-optional'; } if ($f eq "ncftpget"){ @@ -2755,14 +2826,27 @@ Trying with "$funkyftp$src_switch" to get my($system) = "$chdir$funkyftp$src_switch \"$url\" $devnull$stdout_redir"; $self->debug("system[$system]") if $CPAN::DEBUG; - my($wstatus); - if (($wstatus = system($system)) == 0 - && - ($f eq "lynx" ? - -s $asl_ungz # lynx returns 0 when it fails somewhere - : 1 - ) - ) { + my($wstatus) = system($system); + if ($f eq "lynx") { + # lynx returns 0 when it fails somewhere + if (-s $asl_ungz) { + my $content = do { open my $fh, $asl_ungz or die; local $/; <$fh> }; + if ($content =~ /^<.*[45]/si) { + $CPAN::Frontend->myprint(qq{ +No success, the file that lynx has has downloaded looks like an error message: +$content +}); + $CPAN::Frontend->mysleep(1); + next DLPRG; + } + } else { + $CPAN::Frontend->myprint(qq{ +No success, the file that lynx has has downloaded is an empty file. +}); + next DLPRG; + } + } + if ($wstatus == 0) { if (-s $aslocal) { # Looks good } elsif ($asl_ungz ne $aslocal) { @@ -2774,7 +2858,7 @@ Trying with "$funkyftp$src_switch" to get CPAN::Tarzip->new($asl_gz)->gzip($asl_ungz); } } - $Thesite = $ro_url; + $ThesiteURL = $ro_url; return $aslocal; } elsif ($url !~ /\.gz(?!\n)\Z/) { unlink $asl_ungz if @@ -2801,7 +2885,7 @@ Trying with "$funkyftp$src_switch" to get # somebody uncompressed file for us? rename $asl_ungz, $aslocal; } - $Thesite = $ro_url; + $ThesiteURL = $ro_url; return $aslocal; } else { unlink $asl_gz if -f $asl_gz; @@ -2904,7 +2988,7 @@ $dialog $mtime ||= 0; if ($mtime > $timestamp) { $CPAN::Frontend->myprint("GOT $aslocal\n"); - $Thesite = $ro_url; + $ThesiteURL = $ro_url; return $aslocal; } else { $CPAN::Frontend->myprint("Hmm... Still failed!\n"); @@ -2942,7 +3026,7 @@ $dialog $mtime ||= 0; if ($mtime > $timestamp) { $CPAN::Frontend->myprint("GOT $aslocal\n"); - $Thesite = $ro_url; + $ThesiteURL = $ro_url; return $aslocal; } else { $CPAN::Frontend->myprint("Bad luck... Still failed!\n"); @@ -4034,8 +4118,13 @@ sub color_cmd_tmps { # warn "color_cmd_tmps $depth $color " . $self->id; # sleep 1; my $prereq_pm = $self->prereq_pm; if (defined $prereq_pm) { - for my $pre (keys %$prereq_pm) { - my $premo = CPAN::Shell->expand("Module",$pre); + PREREQ: for my $pre (keys %$prereq_pm) { + my $premo; + unless ($premo = CPAN::Shell->expand("Module",$pre)) { + $CPAN::Frontend->mywarn("prerequisite module[$pre] not known\n"); + $CPAN::Frontend->mysleep(2); + next PREREQ; + } $premo->color_cmd_tmps($depth+1,$color,[@$ancestors, $self->id]); } } @@ -4685,7 +4774,18 @@ sub CHECKSUM_check_file { Carp::carp "Could not open $chk_file for reading"; } - if (exists $cksum->{$basename}{sha256}) { + if (! ref $cksum or ref $cksum ne "HASH") { + $CPAN::Frontend->mywarn(qq{ +Warning: checksum file '$chk_file' broken. + +When trying to read that file I expected to get a hash reference +for further processing, but got garbage instead. +}); + my $answer = ExtUtils::MakeMaker::prompt("Proceed nonetheless?", "no"); + $answer =~ /^\s*y/i or $CPAN::Frontend->mydie("Aborted."); + $self->{CHECKSUM_STATUS} = "NIL -- chk_file broken"; + return; + } elsif (exists $cksum->{$basename}{sha256}) { $self->debug("Found checksum for $basename:" . "$cksum->{$basename}{sha256}\n") if $CPAN::DEBUG; @@ -4747,7 +4847,7 @@ going awry right now. my $answer = ExtUtils::MakeMaker::prompt("Proceed?", "yes"); $answer =~ /^\s*y/i or $CPAN::Frontend->mydie("Aborted."); } - $self->{CHECKSUM_STATUS} = "NIL"; + $self->{CHECKSUM_STATUS} = "NIL -- distro not in chk_file"; return; } } @@ -4781,7 +4881,7 @@ sub force { my($self, $method) = @_; for my $att (qw( CHECKSUM_STATUS archived build_dir localfile make install unwrapped - writemakefile + writemakefile modulebuild )) { delete $self->{$att}; } @@ -4880,7 +4980,11 @@ or "Had problems unarchiving. Please build manually"; unless ($self->{force_update}) { - exists $self->{signature_verify} and $self->{signature_verify}->failed + exists $self->{signature_verify} and ( + $self->{signature_verify}->can("failed") ? + $self->{signature_verify}->failed : + $self->{signature_verify} =~ /^NO/ + ) and push @e, "Did not pass the signature test."; } @@ -4986,7 +5090,7 @@ or return 1 if $self->follow_prereqs(@prereq); # signal success to the queuerunner } if ($self->{modulebuild}) { - $system = "./Build $CPAN::Config->{mbuild_arg}"; + $system = sprintf "%s %s", $self->_build_command(), $CPAN::Config->{mbuild_arg}; } else { $system = join " ", _make_command(), $CPAN::Config->{make_arg}; } @@ -5119,6 +5223,7 @@ sub read_yaml { return $self->{yaml_content} if exists $self->{yaml_content}; my $build_dir = $self->{build_dir}; my $yaml = File::Spec->catfile($build_dir,"META.yml"); + $self->debug("yaml[$yaml]") if $CPAN::DEBUG; return unless -f $yaml; if ($CPAN::META->has_inst("YAML")) { eval { $self->{yaml_content} = YAML::LoadFile($yaml); }; @@ -5127,6 +5232,7 @@ sub read_yaml { return; } } + $self->debug("yaml_content[$self->{yaml_content}]") if $CPAN::DEBUG; return $self->{yaml_content}; } @@ -5217,7 +5323,9 @@ sub prereq_pm { } } elsif (-f "Build") { if ($CPAN::META->has_inst("Module::Build")) { - $req = Module::Build->current->requires(); + my $requires = Module::Build->current->requires(); + my $brequires = Module::Build->current->build_requires(); + $req = { %$requires, %$brequires }; } } } @@ -5258,9 +5366,12 @@ sub test { exists $self->{make} or exists $self->{later} or push @e, "Make had some problems, maybe interrupted? Won't test"; - exists $self->{'make'} and - $self->{'make'}->failed and - push @e, "Can't test without successful make"; + exists $self->{make} and + ( + $self->{make}->can("failed") ? + $self->{make}->failed : + $self->{make} =~ /^NO/ + ) and push @e, "Can't test without successful make"; exists $self->{build_dir} or push @e, "Has no own directory"; $self->{badtestcnt} ||= 0; @@ -5289,7 +5400,7 @@ sub test { $CPAN::META->set_perl5lib; my $system; if ($self->{modulebuild}) { - $system = "./Build test"; + $system = sprintf "%s test", $self->_build_command(); } else { $system = join " ", _make_command(), "test"; } @@ -5330,7 +5441,7 @@ sub clean { my $system; if ($self->{modulebuild}) { - $system = "./Build clean"; + $system = sprintf "%s clean", $self->_build_command(); } else { $system = join " ", _make_command(), "clean"; } @@ -5384,12 +5495,20 @@ sub install { exists $self->{make} or exists $self->{later} or push @e, "Make had some problems, maybe interrupted? Won't install"; - exists $self->{'make'} and - $self->{'make'}->failed and + exists $self->{make} and + ( + $self->{make}->can("failed") ? + $self->{make}->failed : + $self->{make} =~ /^NO/ + ) and push @e, "make had returned bad status, install seems impossible"; if (exists $self->{make_test} and - $self->{make_test}->failed){ + ( + $self->{make_test}->can("failed") ? + $self->{make_test}->failed : + $self->{make_test} =~ /^NO/ + )){ if ($self->{force_update}) { $self->{make_test}->text("FAILED but failure ignored because ". "'force' in effect"); @@ -5419,21 +5538,22 @@ sub install { my $system; if ($self->{modulebuild}) { - my($mbuild_install_build_command) = $CPAN::Config->{'mbuild_install_build_command'} || - "./Build"; - $system = join(" ", - $mbuild_install_build_command, - "install", - $CPAN::Config->{mbuild_install_arg}, - ); + my($mbuild_install_build_command) = + exists $CPAN::HandleConfig::keys{mbuild_install_build_command} && + $CPAN::Config->{mbuild_install_build_command} ? + $CPAN::Config->{mbuild_install_build_command} : + $self->_build_command(); + $system = sprintf("%s install %s", + $mbuild_install_build_command, + $CPAN::Config->{mbuild_install_arg}, + ); } else { my($make_install_make_command) = $CPAN::Config->{'make_install_make_command'} || _make_command(); - $system = join(" ", - $make_install_make_command, - "install", - $CPAN::Config->{make_install_arg}, - ); + $system = sprintf("%s install %s", + $make_install_make_command, + $CPAN::Config->{make_install_arg}, + ); } my($stderr) = $^O =~ /Win/i ? "" : " 2>&1 "; @@ -5445,29 +5565,29 @@ sub install { } $pipe->close; if ($?==0) { - $CPAN::Frontend->myprint(" $system -- OK\n"); - $CPAN::META->is_installed($self->{'build_dir'}); - return $self->{'install'} = CPAN::Distrostatus->new("YES"); + $CPAN::Frontend->myprint(" $system -- OK\n"); + $CPAN::META->is_installed($self->{build_dir}); + return $self->{install} = CPAN::Distrostatus->new("YES"); } else { - $self->{'install'} = CPAN::Distrostatus->new("NO"); - $CPAN::Frontend->myprint(" $system -- NOT OK\n"); - if ( - $makeout =~ /permission/s - && $> > 0 - && ( - ! $CPAN::Config->{make_install_make_command} - || $CPAN::Config->{make_install_make_command} eq $CPAN::Config->{make} - ) - ) { - $CPAN::Frontend->myprint( - qq{----\n}. - qq{ You may have to su }. - qq{to root to install the package\n}. - qq{ (Or you may want to run something like\n}. - qq{ o conf make_install_make_command 'sudo make'\n}. - qq{ to raise your permissions.} - ); - } + $self->{install} = CPAN::Distrostatus->new("NO"); + $CPAN::Frontend->myprint(" $system -- NOT OK\n"); + if ( + $makeout =~ /permission/s + && $> > 0 + && ( + ! $CPAN::Config->{make_install_make_command} + || $CPAN::Config->{make_install_make_command} eq $CPAN::Config->{make} + ) + ) { + $CPAN::Frontend->myprint( + qq{----\n}. + qq{ You may have to su }. + qq{to root to install the package\n}. + qq{ (Or you may want to run something like\n}. + qq{ o conf make_install_make_command 'sudo make'\n}. + qq{ to raise your permissions.} + ); + } } delete $self->{force_update}; } @@ -5650,6 +5770,18 @@ sub _getsave_url { } } +# sub CPAN::Distribution::_build_command +sub _build_command { + my($self) = @_; + if ($^O eq "MSWin32") { # special code needed at least up to + # Module::Build 0.2611 and 0.2706; a fix + # in M:B has been promised 2006-01-30 + my($perl) = $self->perl or $CPAN::Frontend->mydie("Couldn't find executable perl\n"); + return "$perl ./Build"; + } + return "./Build"; +} + package CPAN::Bundle; use strict; @@ -6729,6 +6861,12 @@ perl breaks binary compatibility. If one of the modules that CPAN uses is in turn depending on binary compatibility (so you cannot run CPAN commands), then you should try the CPAN::Nox module for recovery. +=head2 mkmyconfig + +mkmyconfig() writes your own CPAN::MyConfig file into your ~/.cpan/ +directory so that you can save your own preferences instead of the +system wide ones. + =head2 The four C<CPAN::*> Classes: Author, Bundle, Module, Distribution Although it may be considered internal, the class hierarchy does matter @@ -7348,6 +7486,7 @@ defined: unzip location of external program unzip urllist arrayref to nearby CPAN sites (or equivalent locations) wait_list arrayref to a wait server to try (See CPAN::WAIT) + ftp_passive if set, the envariable FTP_PASSIVE is set for downloads ftp_proxy, } the three usual variables for configuring http_proxy, } proxy requests. Both as CPAN::Config variables no_proxy } and as environment variables configurable. @@ -7461,6 +7600,13 @@ When the CPAN shell enters a subshell via the look command, it sets the environment CPAN_SHELL_LEVEL to 1 or increments it if it is already set. +When the config variable ftp_passive is set, all downloads will be run +with the environment variable FTP_PASSIVE set to this value. This is +in general a good idea. The same effect can be achieved by starting +the cpan shell with the environment variable. If Net::FTP is +installed, then it can also be configured to always set passive mode +(run libnetcfg). + =head1 POPULATE AN INSTALLATION WITH LOTS OF MODULES Populating a freshly installed perl with my favorite modules is pretty @@ -7643,15 +7789,24 @@ so that STDOUT is captured in a file for later inspection. I am not root, how can I install a module in a personal directory? First of all, you will want to use your own configuration, not the one -that your root user installed. The following command sequence is a -possible approach: +that your root user installed. If you do not have permission to write +in the cpan directory that root has configured, you will be asked if +you want to create your own config. Answering "yes" will bring you into +CPAN's configuration stage, using the system config for all defaults except +things that have to do with CPAN's work directory, saving your choices to +your MyConfig.pm file. + +You can also manually initiate this process with the following command: + + % perl -MCPAN -e 'mkmyconfig' - % mkdir -p $HOME/.cpan/CPAN - % echo '1;' > $HOME/.cpan/CPAN/MyConfig.pm - % cpan - [...answer all questions...] +or by running -You will most probably like something like this: + mkmyconfig + +from the CPAN shell. + +You will most probably also want to configure something like this: o conf makepl_arg "LIB=~/myperl/lib \ INSTALLMAN1DIR=~/myperl/man/man1 \ @@ -7685,18 +7840,17 @@ on first try? The reason for this is that CPAN does not know the dependencies of all modules when it starts out. To decide about the additional items to -install, it just uses data found in the generated Makefile. An -undetected missing piece breaks the process. But it may well be that -your Bundle installs some prerequisite later than some depending item -and thus your second try is able to resolve everything. Please note, -CPAN.pm does not know the dependency tree in advance and cannot sort -the queue of things to install in a topologically correct order. It -resolves perfectly well IFF all modules declare the prerequisites -correctly with the PREREQ_PM attribute to MakeMaker. For bundles which -fail and you need to install often, it is recommended to sort the Bundle -definition file manually. It is planned to improve the metadata -situation for dependencies on CPAN in general, but this will still -take some time. +install, it just uses data found in the META.yml file or the generated +Makefile. An undetected missing piece breaks the process. But it may +well be that your Bundle installs some prerequisite later than some +depending item and thus your second try is able to resolve everything. +Please note, CPAN.pm does not know the dependency tree in advance and +cannot sort the queue of things to install in a topologically correct +order. It resolves perfectly well IF all modules declare the +prerequisites correctly with the PREREQ_PM attribute to MakeMaker or +the C<requires> stanza of Module::Build. For bundles which fail and +you need to install often, it is recommended to sort the Bundle +definition file manually. =item 8) @@ -7708,13 +7862,14 @@ Have a look at the CPAN::Site module. =item 9) -When I run CPAN's shell, I get error msg about line 1 to 4, -setting meta input/output via the /etc/inputrc file. +When I run CPAN's shell, I get an error message about things in my +/etc/inputrc (or ~/.inputrc) file. -Some versions of readline are picky about capitalization in the -/etc/inputrc file and specifically RedHat 6.2 comes with a -/etc/inputrc that contains the word C<on> in lowercase. Change the -occurrences of C<on> to C<On> and the bug should disappear. +These are readline issues and can only be fixed by studying readline +configuration on your architecture and adjusting the referenced file +accordingly. Please make a backup of the /etc/inputrc or ~/.inputrc +and edit them. Quite often harmless changes like uppercasing or +lowercasing some arguments solves the problem. =item 10) @@ -7725,10 +7880,11 @@ expecting ISO-8859-1 charset, a converter can be activated by setting term_is_latin to a true value in your config file. One way of doing so would be - cpan> ! $CPAN::Config->{term_is_latin}=1 + cpan> o conf term_is_latin 1 -Extended support for converters will be made available as soon as perl -becomes stable with regard to charset issues. +If other charset support is needed, please file a bugreport against +CPAN.pm at rt.cpan.org and describe your needs. Maybe we can extend +the support or maybe UTF-8 terminals become widely available. =item 11) @@ -7761,13 +7917,34 @@ Or you leave the CPAN shell and start it again. For the really curious, by accessing internals directly, you I<could> - ! delete CPAN::Shell->expand("Distribution", \ - CPAN::Shell->expand("Module","Foo::Bar") \ - ->cpan_file)->{install} + !delete CPAN::Shell->expandany("Foo::Bar")->distribution->{install} but this is neither guaranteed to work in the future nor is it a decent command. +=item 12) + +How do I install a "DEVELOPER RELEASE" of a module? + +By default, CPAN will install the latest non-developer release of a module. +If you want to install a dev release, you have to specify a partial path to +the tarball you wish to install, like so: + + cpan> install KWILLIAMS/Module-Build-0.27_06.tar.gz + +=item 13) + +How do I install a module and all it's dependancies from the commandline, +without being prompted for anything, despite my CPAN configuration +(or lack thereof)? + +CPAN uses ExtUtils::MakeMaker's prompt() function to ask it's questions, so +if you set the PERL_MM_USE_DEFAULT environment variable, you shouldn't be +asked any questions at all (assuming the modules you are installing are +nice about obeying that variable as well): + + % PERL_MM_USE_DEFAULT=1 perl -MCPAN -e 'install My::Module' + =back =head1 BUGS @@ -7793,9 +7970,3 @@ http://member.nifty.ne.jp/hippo2000/perltips/CPAN.htm cpan(1), CPAN::Nox(3pm), CPAN::Version(3pm) =cut - -# Local Variables: -# coding: utf-8; -# mode: cperl -# cperl-indent-level: 4 -# End: diff --git a/lib/CPAN/FirstTime.pm b/lib/CPAN/FirstTime.pm index 269f8d1..50843ad 100644 --- a/lib/CPAN/FirstTime.pm +++ b/lib/CPAN/FirstTime.pm @@ -2,7 +2,7 @@ package CPAN::Mirrored::By; use strict; use vars qw($VERSION); -$VERSION = sprintf "%.2f", substr(q$Rev: 469 $,4)/100; +$VERSION = sprintf "%.2f", substr(q$Rev: 485 $,4)/100; sub new { my($self,@arg) = @_; @@ -21,7 +21,7 @@ use File::Basename (); use File::Path (); use File::Spec; use vars qw($VERSION); -$VERSION = sprintf "%.2f", substr(q$Rev: 469 $,4)/100; +$VERSION = sprintf "%.2f", substr(q$Rev: 485 $,4)/100; =head1 NAME @@ -324,8 +324,13 @@ Shall we use it as the general CPAN build and cache directory? my_dflt_prompt(make_arg => "", $matcher); - my_dflt_prompt(make_install_make_command => $CPAN::Config->{make} || "", - $matcher); + require CPAN::HandleConfig; + if (exists $CPAN::HandleConfig::keys{make_install_make_command}) { + # as long as Windows needs $self->_build_command, we cannot + # support sudo on windows :-) + my_dflt_prompt(make_install_make_command => $CPAN::Config->{make} || "", + $matcher); + } my_dflt_prompt(make_install_arg => $CPAN::Config->{make_arg} || "", $matcher); @@ -337,7 +342,11 @@ Shall we use it as the general CPAN build and cache directory? my_dflt_prompt(mbuild_arg => "", $matcher); - my_dflt_prompt(mbuild_install_build_command => "./Build", $matcher); + if (exists $CPAN::HandleConfig::keys{mbuild_install_build_command}) { + # as long as Windows needs $self->_build_command, we cannot + # support sudo on windows :-) + my_dflt_prompt(mbuild_install_build_command => "./Build", $matcher); + } my_dflt_prompt(mbuild_install_arg => "", $matcher); diff --git a/lib/CPAN/HandleConfig.pm b/lib/CPAN/HandleConfig.pm index e52a3b2..669e3bb 100644 --- a/lib/CPAN/HandleConfig.pm +++ b/lib/CPAN/HandleConfig.pm @@ -2,7 +2,7 @@ package CPAN::HandleConfig; use strict; use vars qw(%can %keys $dot_cpan $VERSION); -$VERSION = sprintf "%.2f", substr(q$Rev: 469 $,4)/100; +$VERSION = sprintf "%.2f", substr(q$Rev: 488 $,4)/100; %can = ( 'commit' => "Commit changes to disk", @@ -29,6 +29,19 @@ $VERSION = sprintf "%.2f", substr(q$Rev: 469 $,4)/100; unzip urllist wait_list wget ); +if ($^O eq "MSWin32") { + for my $k (qw( + mbuild_install_build_command + make_install_make_command + )) { + delete $keys{$k}; + if (exists $CPAN::Config->{$k}) { + $CPAN::Frontend->mywarn("deleting previously set config variable ". + "'$k' => '$CPAN::Config->{$k}'"); + delete $CPAN::Config->{$k}; + } + } +} # returns true on successful action sub edit { @@ -80,6 +93,7 @@ sub edit { } return $changed; } elsif ($o =~ /_hash$/) { + @args = () if @args==1 && $args[0] eq ""; push @args, "" if @args % 2; $CPAN::Config->{$o} = { @args }; } else { @@ -162,6 +176,11 @@ EOF $CPAN::Frontend->mydie("Couldn't open >$configpm: $!"); $fh->print(qq[$msg\$CPAN::Config = \{\n]); foreach (sort keys %$CPAN::Config) { + unless (exists $keys{$_}) { + $CPAN::Frontend->mywarn("Dropping unknown config variable '$_'\n"); + delete $CPAN::Config->{$_}; + next; + } $fh->print( " '$_' => ", $self->neatvalue($CPAN::Config->{$_}), @@ -352,6 +371,7 @@ sub missing_config_data { "unzip", "urllist", ) { + next unless exists $keys{$_}; push @miss, $_ unless defined $CPAN::Config->{$_}; } return @miss; @@ -418,7 +438,7 @@ package ####::###### #hide from indexer use strict; use vars qw($AUTOLOAD $VERSION); -$VERSION = sprintf "%.2f", substr(q$Rev: 469 $,4)/100; +$VERSION = sprintf "%.2f", substr(q$Rev: 488 $,4)/100; # formerly CPAN::HandleConfig was known as CPAN::Config sub AUTOLOAD { diff --git a/lib/CPAN/SIGNATURE b/lib/CPAN/SIGNATURE index f356bc9..8991293 100644 --- a/lib/CPAN/SIGNATURE +++ b/lib/CPAN/SIGNATURE @@ -14,26 +14,26 @@ not run its Makefile.PL or Build.PL. -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -SHA1 d73dfb45123f36ff3e574eff09b95847c5d085be ChangeLog +SHA1 649da294e424ab12cef006be80f29851eeed8eea ChangeLog SHA1 9b97524a7a91c815e46b19302a33829d3c26bbbf ChangeLog.old -SHA1 138d81e94ae5622b702958e9f82b12efd5c212fd Changes +SHA1 7795d2ac6a0f70f933b47af088417af0e91db952 Changes SHA1 a029ffa2f2252bb8914eb658666244710994d256 Changes.old SHA1 b3fc1dfd25885b80d144cf817b9f0b1c88fe41d6 MANIFEST -SHA1 b20081c83b148a15c6a123bde27825c8288a19db MANIFEST.SKIP -SHA1 c87e310507cb8c99009145ac23bd6404fc2cd9d8 META.yml -SHA1 05b99abbcfa0bc8b19782c4ff95da0fa5c25e2da Makefile.PL +SHA1 eeff7e8175811b30cdcfddd74c30c5ea4c13d43e MANIFEST.SKIP +SHA1 280263caec45d15f670b15d10f29973a56cf49b1 META.yml +SHA1 27df1ed86de0f2b87bba5f7d0bb752690c6eb399 Makefile.PL SHA1 37e858c51409a297ef5d3fb35dc57cd3b57f9a4d PAUSE2003.pub SHA1 af016003ad503ed078c5f8254521d13a3e0c494f PAUSE2005.pub -SHA1 5ef5bb7269c7ce8aaf6403fd2dc364e82525d27c README -SHA1 48b8d4c811d2098762ee6c05dd1d458e6fdff990 Todo +SHA1 c23965271da3c67a1a5a061b9ce7ede5b50a749f README +SHA1 d71298503e8bd777891d72cf2271693c514f5283 Todo SHA1 efbe8e6882a2caa0d741b113959a706830ab5882 inc/Test/Builder.pm SHA1 ae1d68262bedc2475e2c6fd478d99b259b4fb109 inc/Test/More.pm SHA1 06a0406535e8ae4057e374d4ea8cd5b105483803 lib/Bundle/CPAN.pm -SHA1 edd907a918dfefa14e164acd709473dd18d7c4bc lib/CPAN.pm +SHA1 82ab8f61c57da30ae9c67eab1f49cc6ef2da12f5 lib/CPAN.pm SHA1 104fd2b39fdba692143655b53bcf01d36c8ebf68 lib/CPAN/Admin.pm SHA1 82acb5a70221cd4ebc82e96f95f537018e39c79e lib/CPAN/Debug.pm -SHA1 15b207860f9642b5b3313d1cea4843f9bd0ea0d2 lib/CPAN/FirstTime.pm -SHA1 836a525c6ab79bf90175ab0d353c2c134eabf204 lib/CPAN/HandleConfig.pm +SHA1 b5bced5735a8736f317eba67c3319a82345d22c9 lib/CPAN/FirstTime.pm +SHA1 20e41047e4aaa68854186c03d5252ad536d254dc lib/CPAN/HandleConfig.pm SHA1 4fa9695417b54fc8d4e29684ad61689bc108274b lib/CPAN/Nox.pm SHA1 e85202a30802f3cd86e67af649ba219d97b0925c lib/CPAN/Tarzip.pm SHA1 726e924200e3e2fda54caa4eddf7029a02f43efe lib/CPAN/Version.pm @@ -44,13 +44,13 @@ SHA1 215dace24b507de20011d36cbe2d16ddea78bcf3 t/loadme.t SHA1 325d8a2f72d59c4cd2400c72403c05cd614c3abc t/mirroredby.t SHA1 6a79f15a10337bd3450604abf39d4462df2a550b t/pod.t SHA1 274110e8c8353912bb849cec6556f2267b8c5c92 t/shell.t -SHA1 952e77e7944637eed1b5d202afa98baef8a4c64c t/signature.t +SHA1 0c3509be603b7ae86d5e7bd422d9bb6054da0935 t/signature.t SHA1 fdc0f927e3442829ab3b7d40cb63b0223c49abc6 t/vcmp.t SHA1 b505a0db80ed4c835ad5676e9d1cbf09c86e6c34 t/version.t -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) -iD8DBQFD13cm7IA58KMXwV0RAtYQAKCSH0kNMNtkpoPUJxee9YO/2nwbLgCeJxme -qV+u9LyVOVEpi7L2IrVMJPk= -=dy0j +iD8DBQFD4c2e7IA58KMXwV0RAqUtAJ4nelMoeiUIe6JqLAMKqmvTEAbuzgCguPIh +ZiSdaiDh1S5qiobZ9ATaGWY= +=vJZ9 -----END PGP SIGNATURE-----