Subject: Re: Perl CPAN module help
From: Brian Dessent <[email-masked]>
To: [email-masked]
Date: Thu, 13 Nov 2003 12:50:46 -0800

zzapper wrote:
> 
> Peter,
> 
> >cpan
> cpan>
> 
> How do you list modules already installed?

There's no definitive way to do this.  If you just want to see if you
have the Foo::Bar module, you can use "perl -MFoo::Bar -e 1" and if you
get an error then you need to install Foo::Bar.

You can also try the following script which uses the ExtUtils::Installed
module, but I have found that its output is sometimes misleading, in
that it will not display base (stock included) modules.  And I'm not
sure if it knows about modules that are installed through means other
than CPAN (e.g. through your distro's package manager.)

#!/usr/bin/perl

use ExtUtils::Installed;
my $instmod = ExtUtils::Installed->new();
foreach my $module ($instmod->modules()) {
my $version = $instmod->version($module) || "???";
       print "$module -- $version\n";
}

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/