On Fri, 20 Apr 2001, Chip Wiegand wrote:

> I once saw a command for listing the installed modules, but now cannot
> remember it. I am using FreeBSD 4.2 with Apache 1.3.14 and Perl
> 5.005_03. 

CGI.pm is part of the standard Perl distribution, so it will
probably be hard to find a perl installation without it.

But for the general case, here's a few variations.

 $ perl -MCGI -e 1

will print an error if the module is not installed, like:

$ perl -MnoCGI -e 1
Can't locate noCGI.pm in @INC (@INC contains: /usr/libdata/perl/5.00503/mach 
/usr/libdata/perl/5.00503
/usr/local/lib/perl5/site_perl/5.005/i386-freebsd /usr/local/lib/perl5/site_perl/5.005 
.).
BEGIN failed--compilation aborted.

Most module can also have their version checked in a similar manner,

$ perl -MDBI=2 -e 1
DBI 2 required--this is only version 1.15 
(/usr/local/lib/perl5/site_perl/5.005/i386-freebsd/DBI.pm) at -e line 0
BEGIN failed--compilation aborted.

shows me that I have DBI 1.15 installed.

To see a list of all installed modules with a newer version on CPAN,
run the CPAN shell:

 perl -MCPAN -e shell

(here you might have to configure it the first time it runs)

and then type the "r" command at the cpan shell:

cpan> r

Before doing that you might want to install the latest version of
the CPAN module, like

cpan> install CPAN

You can also get information about the currently installed version
of a module by doing a 

cpan> i CGI
Module id = CGI
    CPAN_USERID  LDS (Lincoln D. Stein <[EMAIL PROTECTED]>)
    CPAN_VERSION 2.753
    CPAN_FILE    L/LD/LDS/CGI.pm-2.753.tar.gz
    MANPAGE      CGI - Simple Common Gateway Interface Class
    INST_FILE    /usr/libdata/perl/5.00503/CGI.pm
    INST_VERSION 2.46

tells me that I probably should upgrade my CGI module...


Learn more about the very useful CPAN module by typing

  perldoc CPAN

in the shell.


  - ask

-- 
ask bjoern hansen, http://ask.netcetera.dk/   !try; do();

Reply via email to