- a 'which' for Perl Modules

Download this program

SYNOPSIS Long              # Looks for .*Long.*\.pm -igno long        # Looks for case insensitive .*long.*\.pm 'a.m'             # Looks for "a + one char + m" -exactly DB       # Looks for -startswith DB    # Looks for /^DM.+\.pm/ -endswith DB      # Looks for /DB\.pm$/ .                 # Show all installed modules


This program can be used to show Perl modules available to your Perl installation. Sometimes you remember PART of the name of a module. You can use this program to show you all modules on your @INC path with the module name partially specified. This program was inspired by which searches for executables on your PATH.

This program should work on either Unix or DOS systems where Perl is installed.

Use Perl regular expressions with a module name to find modules on @INC. Don't forget, you may need to escape special characters so the shell will not expand them. E.g. 'l[fc]s'

In addition to your normal @INC and $PERL5LIB path, the program will search additional paths you added to @add2inc at the top of the program.

The default action is to show any module whose name contains the string you provide. For instance, ' DB' would find all modules which have the characters 'DB' in the name (a surprisingly long list typically). This would include '', '', among others.

On well-behaved systems, the following Perl program will show all the modules you have installed (from the Perl FAQ):

  use ExtUtils::Installed;
  my $instmod = ExtUtils::Installed->new();
  foreach my $module ($instmod->modules()) {
  my $version = $instmod->version($module) || "???";
    print "$module -- $version\n";

The Perl module used here relies on .packlist files which SHOULD have been installed with each module. Unfortunately, we all to often live in a world of imperfect systems. The Debian Linux distribution, for instance, does NOT distribute the .packlist files.

This script applies a much more heuristic approach to finding modules. It should find ALL your modules, but it may well find a few MORE than really exist (or may find some sort of duplicate).

This program shows the modules installed for the Perl interpreter that is executing this script. If you have more than one perl binary, you can check each out by specifying the path to Perl explicitly, e.g.

  /usr/local/bin/perl terrys/pgms/ .


-archname NAME
Specifies the archname for this version of Perl. I cannot imagine a reason you would ever specify this. You should be able to see the archname for your Perl with the command: perl -V | grep archname

-dirdepth N
Specifies how many levels the script will look for directories in the @INC trees. Use this to avoid possible loops because of incorrect symlinks. This defaults to 3.

Indicates the the module name 'ends with' the name provided. Specifying '-endswith DB' would find '', but not ''.

Do not use any regular expression matching when looking for the module.

Shows you this help file.

Indicates the the module name comparison should be case insensitive. The default to match the case of the string you provide.

Indicates the the module name 'starts with' the name provided. Specifying '-startswith DB' would find '', but not ''

-verose N
Provides increasingly more additional information. N defaults to 0 (minimal information).


str1 [str2 ... strN]
This is the string used to find modules in your @INC search path. You may specify more than one string (module name) to search for.


If no fatal errors are detected, the program exits with a return code of 0.


Written by Terry Gliedt <> in 2004-2005 This is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; See