Re: perlfaq3: NEW ANSWER: How do I find which modules are installed on my system?

[email protected] (Philip Newton)
Newsgroups perl.perlfaq.workers,perl.documentation
Organization very little
Message-ID <[email protected]>
On Sun, 10 Nov 2002 12:17:55 -0600, [email protected] (_brian_d_foy)
wrote:

> +If you want a list of all of the Perl module filenames, you
> +can use File::Find::Rule.
> +
> +       use File::Find::Rule;
> +
> +       my @files = File::Find::Rule->file()->name( '*.pm' )->in( @INC );

Why not give a recipe with File::Find? Maybe the syntax is not as
pleasing to some, but it's part of the core distribution so you don't
have to fetch a module from CPAN. Something like this should work:

    use File::Find;
    my @files;

    find sub { push @files, $File::Find::name if -f _ && /\.pm$/ },
         @INC;

Cheers,
Philip
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.