cvs commit: perlfaq perlfaq.pod perlfaq3.pod

[email protected]
Newsgroups perl.cvs.perlfaq
Message-ID <[email protected]>
cvsuser     02/11/12 22:23:50

  Modified:    .        perlfaq.pod perlfaq3.pod
  Log:
  * perlfaq3: How do I find which modules are installed on my system?
     + new answer, which seems to be asked rather frequently
  
  Revision  Changes    Path
  1.14      +5 -1      perlfaq/perlfaq.pod
  
  Index: perlfaq.pod
  ===================================================================
  RCS file: /cvs/public/perlfaq/perlfaq.pod,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -w -r1.13 -r1.14
  --- perlfaq.pod	10 Nov 2002 17:35:47 -0000	1.13
  +++ perlfaq.pod	13 Nov 2002 06:23:50 -0000	1.14
  @@ -1,6 +1,6 @@
   =head1 NAME
   
  -perlfaq - frequently asked questions about Perl ($Date: 2002/11/10 17:35:47 $)
  +perlfaq - frequently asked questions about Perl ($Date: 2002/11/13 06:23:50 $)
   
   =head1 DESCRIPTION
   
  @@ -179,6 +179,10 @@
   =item *
   
   Is there a Perl shell?
  +
  +=item *
  +
  +How do I find which modules are installed on my system?
   
   =item *
   
  
  
  
  1.29      +45 -1     perlfaq/perlfaq3.pod
  
  Index: perlfaq3.pod
  ===================================================================
  RCS file: /cvs/public/perlfaq/perlfaq3.pod,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -w -r1.28 -r1.29
  --- perlfaq3.pod	30 Oct 2002 18:41:25 -0000	1.28
  +++ perlfaq3.pod	13 Nov 2002 06:23:50 -0000	1.29
  @@ -1,6 +1,6 @@
   =head1 NAME
   
  -perlfaq3 - Programming Tools ($Revision: 1.28 $, $Date: 2002/10/30 18:41:25 $)
  +perlfaq3 - Programming Tools ($Revision: 1.29 $, $Date: 2002/11/13 06:23:50 $)
   
   =head1 DESCRIPTION
   
  @@ -59,6 +59,50 @@
   from the source distribution is simplistic and uninteresting, but
   may still be what you want.
   
  +=head2 How do I find which modules are installed on my system?
  +
  +You can use the ExtUtils::Installed module to show all
  +installed distributions, 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
  +Mod::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;
  +	
  +If you simply need to quickly check to see if a module is
  +available, you can check for its documentation.  If you can
  +read the documentation the module is most likely installed. 
  +If you cannot read the documentation, the module might not
  +have any (in rare cases).
  +
  +	prompt% perldoc Module::Name
  +
  +You can also try to include the module in a one-liner to see if
  +perl finds it.
  +
  +	perl -MModule::Name -e1
  +	
   =head2 How do I debug my Perl programs?
   
   Have you tried C<use warnings> or used C<-w>?  They enable warnings
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.