#!/import/archperf/ws/devtools/4/v9/bin/perl
eval 'exec /import/archperf/ws/devtools/4/v9/bin/perl -S $0 ${1+"$@"}'
if $running_under_some_shell;
# $Id: cpan,v 1.3 2002/08/30 08:55:15 k Exp $
cpan - easily interact with CPAN from the command line
# with arguments, installs specified modules
cpan module_name [ module_name ... ]
# with switches, installs modules with extra behavior
cpan [-cimt] module_name [ module_name ... ]
# without arguments, starts CPAN shell
# without arguments, but some switches
This script provides a command interface (not a shell) to CPAN.pm.
These options are mutually exclusive, and the script processes
them in this order: [ahvr]. Once the script finds one, it ignores
the others, and then exits after it finishes the task. The script
ignores any other command line options.
Creates the CPAN.pm autobundle with CPAN::Shell->autobundle.
Recompiles dynamically loaded modules with CPAN::Shell->recompile.
Print the script version and CPAN.pm version.
These options are mutually exclusive, and the script processes
them in alphabetical order.
Runs a `make clean` in the specified module's directories.
Installed the specified modules.
Makes the specified modules.
Runs a `make test` on the specified modules.
# print the version numbers
cpan -i Netscape::Booksmarks Business::ISBN
* add options for other CPAN::Shell functions
autobundle, clean, make, recompile, test
Most behaviour, including environment variables and configuration,
comes directly from CPAN.pm.
brian d foy <bdfoy@cpan.org>
sprintf "%d.%02d", q$Revision: 1.3 $ =~ m/ (\d+) \. (\d+) /xg;
my $META_OPTIONS = 'ahvr';
my @cpan_options = grep { $_ ne $Default } sort keys %CPAN_METHODS;
join( '', @cpan_options, $META_OPTIONS ), \%options );
print STDERR "Printing help message -- ignoring other arguments\n"
print STDERR "Use perldoc to read the documentation\n";
print STDERR "Printing version message -- ignoring other arguments\n"
my $CPAN_VERSION = CPAN->VERSION;
print STDERR "cpan script version $VERSION\n" .
"CPAN.pm version $CPAN_VERSION\n";
print "Creating autobundle in ", $CPAN::Config->{cpan_home},
print STDERR "Creating autobundle -- ignoring other arguments\n"
print STDERR "Creating autobundle -- ignoring other arguments\n"
foreach my $option ( @cpan_options )
next unless $options{$option};
if( not $switch and @ARGV ) { $switch = $Default; }
elsif( not $switch and not @ARGV ) { CPAN::shell(); exit 0; }
elsif( $switch and not @ARGV )
{ die "Nothing to $CPAN_METHODS{$switch}!\n"; }
my $method = $CPAN_METHODS{$switch};
die "CPAN.pm cannot $method!\n" unless CPAN::Shell->can( $method );
foreach my $arg ( @ARGV )
CPAN::Shell->$method( $arg );