[oak perl] listing modules

Belden Lyman blyman at iii.com
Tue Sep 14 15:00:46 CDT 2004


On Tue, 2004-09-14 at 12:54, Steve Fink wrote:
> > On Tue, 2004-09-14 at 09:49, David Fetter wrote:
> > 
> >>On Tue, Sep 14, 2004 at 08:39:24AM -0700, Belden Lyman wrote:
> >>>
> >>>That only tells you the modules installed by whomever has write
> >>>permission on perllocal.pod.
> >>
> >>True.  Short of find / or locate, is there some other way to find
> >>the rest?
> 
> Well, they all have to be findable through @INC, so would this get you 
> something close enough?
> 
>   perl -le 'print foreach map { glob("$_/*.pm") } @INC'

No, that's not true. lib.pm, -I switch to perl, and installation of 
modules into home directories can all yield modules findable by a
particular instance of the perl interpreter, yet not located anywhere
within @INC.

Even if that were the case, your one-liner wouldn't work for modules
such as IO::Socket::INET, because $_ would never be IO/Socket. A
different approach would be:

    perl -MFile::Find -le'find(sub{/\.pm$/ and print
$File::Find::name}, at INC)'

Belden



More information about the Oakland mailing list