mklement0/whichpm


Locates installed Perl modules.

  • Users starred: 19
  • Users forked: 6
  • Users watching: 19
  • Updated at: 2020-04-10 21:56:34

npm version license

Contents

whichpm — introduction

whichpm is a cross-platform CLI that locates installed Perl modules, and optionally reports information about them, including detection of accidental duplicates.

Analogous to how the common which Unix utility locates binaries by their filename, whichpm locates Perl modules by their module (package) name.

Examples

# Locate the Data::Dumper module.
$ whichpm Data::Dumper
/usr/lib/perl/5.18/Data/Dumper.pm

# Locate the Data::Dumper module, and also print
# version information and core-module status.
$ whichpm -v Data::Dumper
Data::Dumper    2.145   core>=5.005 /usr/lib/perl/5.18/Data/Dumper.pm

# Locate the Data::Dumper module and open it in your system's default text
# editor.
$ whichpm -e Data::Dumper

# Look for accidental duplicates of the Foo::Bar module.
# Normally, only 1 path should be returned.
$ whichpm -a Foo::Bar
/usr/lib/perl/5.18/Foo/Bar.pm
./Foo/Bar.pm

# Print the paths of all installed modules.
$ whichpm -a

Installation

Supported platforms and prerequisites

Linux, macOS, and Windows, with Perl v5.4.50 or higher installed.

Installation from the npm registry

Note: Even if you don't use Node.js, its package manager, npm, works across platforms and is easy to install with curl -L http://git.io/n-install | bash

With Node.jsinstalled, install the package as follows:

[sudo] npm install whichpm -g

Note:

  • Whether you need sudo depends on how you installed Node.js and whether you've changed permissions later; if you get an EACCES error, try again with sudo.
  • The -g ensures global installation and is needed to put whichpm in your system's $PATH.

Manual installation (macOS and Linux)

  • Download the CLI as whichpm.
  • Make it executable with chmod +x whichpm.
  • Move it or symlink it to a folder in your $PATH, such as /usr/local/bin (macOS) or /usr/bin (Linux).

Usage

Find brief usage information below; for complete documentation, run whichpm --man or read the manual online.

$ whichpm --help


Prints the filesystem paths of the specified Perl modules, if installed.

    whichpm    [-v] [-q] [-e] <module_name>...
    whichpm -a [-v] [-q] [-e] [<module_name>...]

    -a ... lists all installed module files / all module files matching  
           the specified name(s) (checks for accidental duplicates)
    -v ... verbose mode: also prints name, version, core-module status
    -q ... suppresses warnings
    -e ... opens modules in default text editor

Standard options: --help, --man, --version, --home

License

Copyright (c) 2020 Michael Klement mklement0@gmail.com (http://same2u.net), released under the MIT license.

Acknowledgements

This project gratefully depends on the following open-source components, according to the terms of their respective licenses.

npm dependencies below have optional suffixes denoting the type of dependency; the absence of a suffix denotes a required run-time dependency: (D) denotes a development-time-only dependency, (O) an optional dependency, and (P) a peer dependency.

npm dependencies

Changelog

Versioning complies with semantic versioning (semver).

  • v0.2.0 (2020-01-14):

    • [enhancement] If duplicate module search paths are found in @INC, a warning is now issued (suppress with -q). Technically, this is a breaking change in that previous callers may not anticipate the additional stderr output.
  • v0.1.8 (2020-01-14):

    • [doc] Read-me improvements.
    • [dev] Dev dependencies updated.
  • v0.1.7 (2015-09-16):

    • [doc] man page improvements.
  • v0.1.6 (2015-09-16):

    • [doc] man page improvements.
  • v0.1.5 (2015-09-15):

    • [dev] Makefile improvements; various other behind-the-scenes tweaks.
  • v0.1.4 (2015-09-03):

    • [dev] Missing dev. dependency marked-man added.
  • v0.1.3 (2015-09-02):

    • [doc] Formatting error in man page corrected.
  • v0.1.2 (2015-09-02):

    • [fix] Fixed too-permissive check for the -h / --help option.
  • v0.1.1 (2015-09-02):

    • [fix] Fixed broken man-page installation - man whichpm should now work on Linux and OSX.
  • v0.1.0 (2015-09-01):

    • Initial release.