Finding installed modules

Finding installed modules

am 08.01.2008 22:52:33 von Bernie Cosell

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

Re: Finding installed modules

am 08.01.2008 23:09:25 von Gunnar Hjalmarsson

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

Re: Finding installed modules

am 09.01.2008 00:13:51 von Bernie Cosell

Gunnar Hjalmarsson wrote:

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

Re: Finding installed modules

am 09.01.2008 16:34:57 von Peter Scott

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/