#!/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"; }