At 7:34 PM -0700 9/4/09, Noah Garrett Wallach wrote:
Hi there,

this might be obvious but how can I find a list of all the perldoc modules?


Perldoc will only work for modules that are installed on your system. The directories in which Perl will search for modules is given by the array @INC. You can get a list of directories in @INC with 'perl -V' (capital V). Perl modules will have a '.pm' file extension.

From 'perldoc -q modules' "How do I find which modules are installed on my system?"

Since your perldoc isn't working, here it is:

How do I find which modules are installed on my system?

       You can use the ExtUtils::Installed module to show all installed dis-
       tributions, although it can take awhile to do its magic.  The standard
       library which comes with Perl just shows up as "Perl" (although you can
       get those with Module::CoreList).

               use ExtUtils::Installed;

               my $inst    = ExtUtils::Installed->new();
               my @modules = $inst->modules();

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

       If you do not have that module, you can do the same thing with
       File::Find which is part of the standard library.

           use File::Find;
:          my @files;

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

               print join "\n", @files;


--
Jim Gibson
j...@gibson.org

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to