Click here to get back home

Finding installed modules

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Finding installed modules Bernie Cosell 01-08-2008
Posted by Bernie Cosell on January 8, 2008, 4:52 pm
Please log in for more thread options
I was poking around at scripts to locate all installed modules and I'm a
little confused [or else I'm missing something]. *every* script I found
after a quick Google uses File::Find on @INC, but that seems wrong: my
guess [verified by a quick test pgm] is that 'use' does *NOT* search
subdirectories.

So: Is there some trick I'm not seeing in using File::Find to *prevent* it
from descending into subdirectories or is it really correct to do a
recursive search off of @INC to find modules??

[Assuming my guess here is correct, it looks to me like a better scheme is
just to use opendir/readdir to locate installed modules rather than ::Find,
no?]

/Bernie\
--
Bernie Cosell Fantasy Farm Fibers
bernie@fantasyfarm.com Pearisburg, VA
--> Too many people, too few sheep <--

Posted by Gunnar Hjalmarsson on January 8, 2008, 5:09 pm
Please log in for more thread options
Bernie Cosell wrote:
> I was poking around at scripts to locate all installed modules and I'm a
> little confused [or else I'm missing something]. *every* script I found
> after a quick Google uses File::Find on @INC, but that seems wrong: my
> guess [verified by a quick test pgm] is that 'use' does *NOT* search
> subdirectories.

Well, let's take an example. If @INC contains the path
/usr/lib/perl5/5.8.6 and Find.pm is located in
/usr/lib/perl5/5.8.6/File, how would 'use' find the File::Find module
without looking in the subdirectories?

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

Posted by Bernie Cosell on January 8, 2008, 6:13 pm
Please log in for more thread options

} Bernie Cosell wrote:
} > I was poking around at scripts to locate all installed modules and I'm a
} > little confused [or else I'm missing something]. *every* script I found
} > after a quick Google uses File::Find on @INC, but that seems wrong: my
} > guess [verified by a quick test pgm] is that 'use' does *NOT* search
} > subdirectories.
}
} Well, let's take an example. If @INC contains the path
} /usr/lib/perl5/5.8.6 and Find.pm is located in
} /usr/lib/perl5/5.8.6/File, how would 'use' find the File::Find module
} without looking in the subdirectories?

Yeah, I realized that right after I posted my inquiry. The key part is to
use ::Find with "nochdir" so you can reconstruct the proper '::' name for
the subdirectoried [is that a word? :o)] modules.

Thanks! /bernie\
--
Bernie Cosell Fantasy Farm Fibers
bernie@fantasyfarm.com Pearisburg, VA
--> Too many people, too few sheep <--

Posted by Peter Scott on January 9, 2008, 10:34 am
Please log in for more thread options
On Tue, 08 Jan 2008 16:52:33 -0500, Bernie Cosell wrote:
> I was poking around at scripts to locate all installed modules and I'm a
> little confused [or else I'm missing something]. *every* script I found
> after a quick Google uses File::Find on @INC,

Really? How about CPAN.pm? Look under Programming Examples:

http://search.cpan.org/~andk/CPAN-1.9205/lib/CPAN.pm

        for $mod (CPAN::Shell->expand("Module","/./")) { ...

--
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/


Similar ThreadsPosted
Updating installed modules? June 23, 2006, 3:36 am
List of all modules installed on a system August 8, 2007, 1:41 pm
Modules installed with PPM -- how to install on air-gapped machines December 30, 2004, 7:16 pm
Finding out the time on an FTP server using perl August 30, 2005, 5:27 am
Problems finding gd.pm in perl 5.8.6 using linux February 16, 2006, 4:59 pm
finding version number of a library August 10, 2007, 6:54 am
Problem with MIME-tools 5.414 not finding encode_qp October 27, 2004, 8:00 pm
finding the most relevant keywords or phrases of a content using a perl program September 21, 2005, 7:10 am
What is installed December 8, 2005, 11:18 am
2 versions of a module installed? December 29, 2004, 1:27 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap