delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/11/13/18:44:05

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <3FB4171B.30706@sonic.net>
Date: Thu, 13 Nov 2003 15:43:23 -0800
From: Doug VanLeuven <roamdad AT sonic DOT net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5b) Gecko/20030901 Thunderbird/0.2
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Perl CPAN module help
References: <3FB3B2CB AT epostleser DOT online DOT no> <6jc7rv4palt1j9tpjomtfdg802udungc0t AT 4ax DOT com> <3FB3EEA6 DOT 10EB0BD5 AT dessent DOT net>
In-Reply-To: <3FB3EEA6.10EB0BD5@dessent.net>
X-MailScanner-Information: Please contact the ISP for more information
X-MailScanner: Found to be clean

Brian Dessent wrote:

>>
>>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.)

I've been doing something similar.
Really it's been so long now, I forget it's origins or much of anything
about the why or how of it other than it's a comprehensive listing
that lets me know what I have & the status of the versions.

#!/usr/bin/perl

use CPAN;
# list all modules on my disk and note the newer versions
for $mod (CPAN::Shell->expand("Module","/./")){
         next unless $mod->inst_file;
                 # here only when installed
         if ($mod->inst_version eq "undef") {
                 printf "%s :No VERSION\n", $mod->id;
         }
         elsif ($mod->uptodate){
                 printf "%s %s\n", $mod->id, $mod->inst_version
         }
         else {
                 # here when not up to date
         printf "%s %s, NEW VERSION=%s\n",
                 $mod->id, $mod->inst_version, $mod->cpan_version;
         }
}

Doug VanLeuven


--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019