473,385 Members | 1,912 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Listing installed perl modules

Is there a command that allows me to list all the installed Perl modules on
my machine?
Jul 19 '05 #1
3 12154
gusmeister wrote:
Is there a command that allows me to list all the installed Perl
modules on my machine?


The FAQ used to include an entry about it, but for some unscrutinable
reason that entry seems to have been removed.

You can write some code using File::Find and the @INC variable, but an
easier approach is to use this script:
http://www.scriptsolutions.com/programs/free/perldiver/

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Jul 19 '05 #2
gusmeister wrote:
Is there a command that allows me to list all the installed Perl modules on
my machine?


If you've set up CPAN, use
perl -MCPAN -e autobundle
to get a list of the modules and version numbers.
-Joe
Jul 19 '05 #3
"gusmeister" <gu****************@sympatico.ca> wrote in message news:<F2********************@news20.bellglobal.com >...
Is there a command that allows me to list all the installed Perl modules on
my machine?
If you're using ActivePerl, you can also do:
ppm query *


This will tell you all the PPM PACKAGES that are installed, but not
necessarily all the MODULES that are installed.

Alternatively, you could do something like:

use strict;
use warnings;

my %libs;

sub workdir {
my ($dir,$prefix) = (@_,'');
$prefix and $prefix .= '::';
opendir DIR, $dir;
for my $f (grep {!/^\.\.?$/} readdir(DIR)) {
if (-f "$dir/$f" && $f =~ /^(.*)\.pm$/i) {
$libs{"${prefix}$1"} = '';
} elsif (-d "$dir/$f") {
&workdir("$dir/$f", "$prefix$f");
}
}
}

my @libs;
for my $inc (@INC) {
workdir($inc);
}
for (sort keys %libs) {
print "$_\n";
}

This is NOT complete, though. To TRULY work, you really need to check
if the package specified in the .pm file matches the package you're
purporting it to be in. (For example, if you've got a bunch of .pm
files really deep below ., but they're not in a package, they'd still
show up in a package that looks like the directory structure.)
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Xah Lee | last post by:
# -*- coding: utf-8 -*- # Python # some venture into standard modules import os # print all names exported by the module print dir(os)
0
by: Terry | last post by:
Hi all, I am helping someone to investigate a problem with a perl tool that we are using. The problem is completely random and it does not produce any errors. The tool is supposed to encrypt...
9
by: Dieter Vanderelst | last post by:
Dear all, I'm currently comparing Python versus Perl to use in a project that involved a lot of text processing. I'm trying to determine what the most efficient language would be for our...
1
by: Freddo | last post by:
Hello, I'm using ActiveState's perl v5.8.7 built for MSWin32-x86-multi-thread on a WinXP machine. I'd like to know if there's a easy way to dump a list of the installed modules (via ppm) and...
1
by: Bill Cunningham | last post by:
Now what is the difference in perl programs and perl modules? I see :: alot. This is coming from a guy who taught himself Basic at around 15 yo and left interpreters after that. Now the only...
5
by: jain236 | last post by:
HI every body, i am always getting the following error while parsing a directory . i am reading a directory by doing ls and trying to find out the name,type,size, mtime and mode of files from...
0
by: Lie | last post by:
Yesterday I installed compiz-icon in my Ubuntu. Today, when I go to the python interpreter, I happen to do this: ### START OF PYTHON SESSION ### Python 2.5.2 (r252:60911, Apr 21 2008, 11:17:30)...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.