[ale] Re: installing cpan modules from the command line

Robert Gash gashalot at gashalot.com
Wed Jan 22 20:24:50 EST 2003


On 22 Jan 2003 20:27:16 -0500, Mike Lockhart was overheard saying:
|  This one's for all you Perl guys out there.  How would I go about
|  checking to see if a perl module is installed, and how would I install a
|  perl module, all from the command line?  I'm putting together a script
|  to install files for a program package, and the perl thing kinda has me
|  stumped.  I know it goes somthing like "perl -MCPAN -e
|  'CPAN::Shell->install(CPAN::ModuleName)', i think.  Thanks.

Two simple one liners for you:

1) Check to see if a module is installed:
perl -e 'use Mymodule::Name;'

If you get a silent return it's installed, otherwise you get something
like this:

gashalot at jamesbrown(ttyp0):~$ perl -e 'use foo;'
Can't locate foo.pm in @INC (@INC contains: ...

2) Install from the command line:

perl -MCPAN -e 'install Mymodule::Name'

Optionally you can run the CPAN shell by typing:

perl -MCPAN -e 'shell'

-R

-- 
Robert Gash, gashalot at gashalot.com
(Web) http://gashalot.com/
(PGP) http://gashalot.com/pgpkeys.txt

_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale






More information about the Ale mailing list