# -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*-
use strict;
package CPAN;
-$CPAN::VERSION = '1.88_77';
+$CPAN::VERSION = '1.88_78';
$CPAN::VERSION = eval $CPAN::VERSION;
use CPAN::HandleConfig;
BEGIN {
if (File::Spec->can("rel2abs")) {
for my $inc (@INC) {
- $inc = File::Spec->rel2abs($inc);
+ $inc = File::Spec->rel2abs($inc) unless ref $inc;
}
}
}
require Mac::BuildTools if $^O eq 'MacOS';
$ENV{PERL5_CPAN_IS_RUNNING}=1;
+$ENV{PERL5_CPANPLUS_IS_RUNNING}=1; # https://rt.cpan.org/Ticket/Display.html?id=23735
END { $CPAN::End++; &cleanup; }
$CONFIG_DIRTY
$Defaultdocs
$Defaultrecent
+ $Echo_readline
$Frontend
$GOTOSHELL
$HAS_USABLE
my $last_term_ornaments;
SHELLCOMMAND: while () {
if ($Suppress_readline) {
+ if ($Echo_readline) {
+ $|=1;
+ }
print $prompt;
last SHELLCOMMAND unless defined ($_ = <> );
+ if ($Echo_readline) {
+ # backdoor: I could not find a way to record sessions
+ print $_;
+ }
chomp;
} else {
last SHELLCOMMAND unless
return if $CPAN::Signal;
my($Du) = 0;
if (-e $dir) {
- unless (-x $dir) {
- unless (chmod 0755, $dir) {
- $CPAN::Frontend->mywarn("I have neither the -x permission nor the ".
- "permission to change the permission; cannot ".
- "estimate disk usage of '$dir'\n");
- $CPAN::Frontend->mysleep(5);
- return;
+ if (-d $dir) {
+ unless (-x $dir) {
+ unless (chmod 0755, $dir) {
+ $CPAN::Frontend->mywarn("I have neither the -x permission nor the ".
+ "permission to change the permission; cannot ".
+ "estimate disk usage of '$dir'\n");
+ $CPAN::Frontend->mysleep(5);
+ return;
+ }
}
+ } elsif (-f $dir) {
+ # nothing to say, no matter what the permissions
}
} else {
- $CPAN::Frontend->mywarn("Directory '$dir' has gone. Cannot continue.\n");
+ $CPAN::Frontend->mywarn("File or directory '$dir' has gone, ignoring\n");
return;
}
find(
# but maybe we get a solution from the first user who hits
# this unfortunate exception?
$CPAN::Frontend->mywarn("Warning: Could not expand string '$s' ".
- "to an object. Skipping.");
+ "to an object. Skipping.\n");
$CPAN::Frontend->mysleep(5);
+ CPAN::Queue->delete_first($s);
next;
}
$obj->{reqtype} ||= "";
} else {
$self->{was_uncompressed}++ unless $ct->gtest();
$local_file = $self->handle_singlefile($local_file);
-# } else {
-# $self->{archived} = "NO";
-# $self->safe_chdir($sub_wd);
-# return;
}
# we are still in the tmp directory!
return unless $self->patch;
if (lc($prefer_installer) eq "mb") {
$self->{modulebuild} = 1;
+ } elsif ($self->{archived} eq "patch") {
+ # not an edge case, nothing to install for sure
+ my $why = "A patch file cannot be installed";
+ $CPAN::Frontend->mywarn("Refusing to handle this file: $why\n");
+ $self->{writemakefile} = CPAN::Distrostatus->new("NO $why");
} elsif (! $mpl_exists) {
$self->_edge_cases($mpl,$packagedir,$local_file);
}
if ( $local_file =~ /\.pm(\.(gz|Z))?(?!\n)\Z/ ){
$self->{archived} = "pm";
+ } elsif ( $local_file =~ /\.patch(\.(gz|bz2))?(?!\n)\Z/ ) {
+ $self->{archived} = "patch";
} else {
$self->{archived} = "maybe_pl";
}
$self->{unwrapped} = CPAN::Distrostatus->new("NO -- uncompressing failed");
}
} else {
- File::Copy::cp($local_file,".");
- $self->{unwrapped} = CPAN::Distrostatus->new("NO -- copying failed");
+ if (File::Copy::cp($local_file,".")) {
+ $self->{unwrapped} = CPAN::Distrostatus->new("YES");
+ } else {
+ $self->{unwrapped} = CPAN::Distrostatus->new("NO -- copying failed");
+ }
}
return $to;
}
my $ok = 1;
# do not take the order of C<keys %$match> because
# "module" is by far the slowest
- for my $sub_attribute (qw(distribution perl module)) {
+ my $saw_valid_subkeys = 0;
+ for my $sub_attribute (qw(distribution perl perlconfig module)) {
next unless exists $match->{$sub_attribute};
+ $saw_valid_subkeys++;
my $qr = eval "qr{$distropref->{match}{$sub_attribute}}";
if ($sub_attribute eq "module") {
my $okm = 0;
} elsif ($sub_attribute eq "perl") {
my $okp = $^X =~ /$qr/;
$ok &&= $okp;
+ } elsif ($sub_attribute eq "perlconfig") {
+ for my $perlconfigkey (keys %{$match->{perlconfig}}) {
+ my $perlconfigval = $match->{perlconfig}->{$perlconfigkey};
+ # XXX should probably warn if Config does not exist
+ my $okpc = $Config::Config{$perlconfigkey} =~ /$perlconfigval/;
+ $ok &&= $okpc;
+ last if $ok == 0;
+ }
} else {
$CPAN::Frontend->mydie("Nonconforming .$thisexte file '$abs': ".
"unknown sub_attribut '$sub_attribute'. ".
}
last if $ok == 0; # short circuit
}
+ unless ($saw_valid_subkeys) {
+ $CPAN::Frontend->mydie("Nonconforming .$thisexte file '$abs': ".
+ "missing match/* subattribute. ".
+ "Please ".
+ "remove, cannot continue.");
+ }
#CPAN->debug(sprintf "ok[%d]", $ok) if $CPAN::DEBUG;
if ($ok) {
return {
module: "Dancing::Queen"
distribution: "^CHACHACHA/Dancing-"
perl: "/usr/local/cariba-perl/bin/perl"
+ perlconfig:
+ archname: "freebsd"
disabled: 1
cpanconfig:
make: gmake
=item match [hash]
-A hashref with one or more of the keys C<distribution>, C<modules>, or
-C<perl> that specify if a document is targeted at a specific CPAN
-distribution.
+A hashref with one or more of the keys C<distribution>, C<modules>,
+C<perl>, and C<perlconfig> that specify if a document is targeted at a
+specific CPAN distribution or installation.
The corresponding values are interpreted as regular expressions. The
C<distribution> related one will be matched against the canonical
The C<perl> related one will be matched against C<$^X>.
+The value associated with C<perlconfig> is itself a hashref that is
+matched against corresponding values in the C<%Config::Config> hash
+living in the C< Config.pm > module.
+
If more than one restriction of C<module>, C<distribution>, and
C<perl> is specified, the results of the separately computed match
values must all match. If this is the case then the hashref
use File::Path ();
use File::Spec ();
use vars qw($VERSION $urllist);
-$VERSION = sprintf "%.6f", substr(q$Rev: 1536 $,4)/1000000 + 5.4;
+$VERSION = sprintf "%.6f", substr(q$Rev: 1612 $,4)/1000000 + 5.4;
=head1 NAME
}
$path ||= find_exe($progcall,\@path);
- {
+ unless ($path){ # not -e $path, because find_exe already checked that
local $"=";";
- $CPAN::Frontend->mywarn("Warning: $progcall not found in PATH[@path]\n") unless
- $path; # not -e $path, because find_exe already checked that
+ $CPAN::Frontend->mywarn("Warning: $progcall not found in PATH[@path]\n");
+ if ($progname eq "make") {
+ $CPAN::Frontend->mywarn("ALERT: 'make' is an essential tool for ".
+ "building perl Modules. Please make sure you ".
+ "have 'make' (or some equivalent) ".
+ "working.\n"
+ );
+ if ($^O eq "MSWin32") {
+ $CPAN::Frontend->mywarn("
+Windows users may want to follow this procedure when back in the CPAN shell:
+
+ look YVES/scripts/alien_nmake.pl
+ perl alien_nmake.pl
+
+This will install nmake on your system which can be used as a 'make'
+substitute. You can then revisit this dialog with
+
+ o conf init make
+
+");
+ }
+ }
}
$ans = prompt("Where is your $progname program?",$path) || $path;
$CPAN::Config->{$progname} = $ans;
#!/usr/bin/perl
-# $Id: cpan,v 1.7 2006/01/11 06:22:32 comdog Exp $
+# $Id: cpan,v 1.9 2006/11/01 21:49:31 comdog Exp $
use strict;
=head1 NAME
# with switches, installs modules with extra behavior
cpan [-cfimt] module_name [ module_name ... ]
- # without arguments, starts CPAN shell
+ # without arguments, starts CPAN.pm shell
cpan
# without arguments, but some switches
=head1 DESCRIPTION
-This script provides a command interface (not a shell) to CPAN.pm.
+This script provides a command interface (not a shell) to CPAN. At the
+moment it uses CPAN.pm to do the work, but it is not a one-shot command
+runner for CPAN.pm.
=head2 Meta Options
Jim Brandt suggest and provided the initial implementation for the
up-to-date and Changes features.
+Adam Kennedy pointed out that exit() causes problems on Windows
+where this script ends up with a .bat extension
+
=head1 AUTHOR
brian d foy, C<< <bdfoy@cpan.org> >>
use Getopt::Std;
my $VERSION =
- sprintf "%d.%d", q$Revision: 403 $ =~ m/ (\d+) \. (\d+) /xg;
+ sprintf "%d.%d", q$Revision: 1.9 $ =~ m/ (\d+) \. (\d+) /xg;
+
+if( $ARGV[0] eq 'install' )
+ {
+ my @args = @ARGV;
+ shift @args;
+
+ die <<"HERE";
+It looks like you specified 'install' as an argument to cpan(1). This
+script is not the CPAN.pm prompt and doesn't understand the same commands.
+In fact, doesn't require the extra typing. You probably just want to
+list the modules you want to install:
+ cpan @args
+
+See the documentation for more details on using this script.
+HERE
+ }
+
if( 0 == @ARGV ) { CPAN::shell(); exit 0 }
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# 2. with no switches and no args, start the shell
# 3. With a switch but no args, die! These switches need arguments.
if( not $switch and @$args ) { $switch = $Default; }
- elsif( not $switch and not @$args ) { CPAN::shell(); exit 0; }
+ elsif( not $switch and not @$args ) { CPAN::shell(); return }
elsif( $switch and not @$args )
{ die "Nothing to $CPAN_METHODS{$switch}!\n"; }
CPAN::Shell->autobundle;
}
-sub _recompiling
+sub _recompile
{
print "Recompiling dynamically-loaded extensions\n";