Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

instmodsh only shows your locally installed modules - that is, the things you installed using CPAN. It will not list core modules or things that automatically come with your Perl distribution (for example, the debconf modules that are installed on all Debian systems).

To check if a particular module is installed, you can use the perldoc command:

  • perldoc -l Foo::Bar prints out the full path to the module
  • perldoc -m Foo::Bar displays the contents of the module file

If you want to see all the modules available given your current search path, try the following short script. This script works on both Win and *nix:

use strict; use warnings; use File::Find; my @aModules; foreach my $sDir (@INC) { my $crFind = sub { my $sModule = substr($File::Find::name, length($sDir)+1); push(@aModules, $sModule) if (($sModule =~ s/\.pm$//) || ($sModule =~ /\.pl$/)); }; find($crFind, ("$sDir/")) if -d $sDir; }; print '' . join("\n", sort @aModules) . "\n";

Note: the main difference between oko1's solution and mine is that oko1 provides support for filtering your module list with regexes but does not sort modules or list .pl files. The solution above does not support regex selection but does sort modules and list .pl files.

Best, beth

Update: fixed cut&paste error in script.

Update: eliminated warnings for missing @INC dirs; insured directory name is terminated with "/" so that File::Find doesn't think directory names with dots (e.g. /usr/share/perl/5.8) are files and skip them -silly File::Find) - with thanks to oko1 whose code sample below alerted me to these problems. Also added note comparing oko1 solution below and this solution.


In reply to Re: perl modules by ELISHEVA
in thread perl modules by manish.rathi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-04-25 16:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found