Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mklement0/whichpm

Locates installed Perl modules.
https://github.com/mklement0/whichpm

cli directories discovery filesystem filesystem-path folders module perl5 unix windows

Last synced: about 1 month ago
JSON representation

Locates installed Perl modules.

Awesome Lists containing this project

README

        

[![npm version](https://img.shields.io/npm/v/whichpm.svg)](https://npmjs.com/package/whichpm) [![license](https://img.shields.io/npm/l/whichpm.svg)](https://github.com/mklement0/whichpm/blob/master/LICENSE.md)

**Contents**

- [whichpm — introduction](#whichpm-&mdash-introduction)
- [Examples](#examples)
- [Installation](#installation)
- [Installation from the npm registry](#installation-from-the-npm-registry)
- [Manual installation (macOS and Linux)](#manual-installation-macos-and-linux)
- [Usage](#usage)
- [License](#license)
- [Acknowledgements](#acknowledgements)
- [npm dependencies](#npm-dependencies)
- [Changelog](#changelog)

# whichpm — introduction

`whichpm` is a cross-platform CLI that locates installed [Perl](https://www.perl.org/) 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

```nohighlight
# 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`](https://github.com/mklement0/n-install)

With [Node.js](http://nodejs.org/)installed, install [the package](https://www.npmjs.com/package/whichpm) 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](https://docs.npmjs.com/getting-started/fixing-npm-permissions); if you get an `EACCES` error, try again with `sudo`.
* The `-g` ensures [_global_ installation](https://docs.npmjs.com/getting-started/installing-npm-packages-globally) and is needed to put `whichpm` in your system's `$PATH`.

## Manual installation (macOS and Linux)

* Download [the CLI](https://raw.githubusercontent.com/mklement0/whichpm/stable/bin/whichpm) 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](doc/whichpm.md).

```nohighlight
$ whichpm --help

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

whichpm [-v] [-q] [-e] ...
whichpm -a [-v] [-q] [-e] [...]

-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 (http://same2u.net), released under the [MIT license](https://spdx.org/licenses/MIT#licenseText).

## Acknowledgements

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

[npm](https://www.npmjs.com/) 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

* [doctoc (D)](https://github.com/thlorenz/doctoc)
* [json (D)](https://github.com/trentm/json)
* [marked-man (D)](https://github.com/kapouer/marked-man#readme)
* [replace (D)](https://github.com/ALMaclaine/replace#readme)
* [semver (D)](https://github.com/npm/node-semver#readme)
* [urchin (D)](https://git.sdf.org/tlevine/urchin)

# Changelog

Versioning complies with [semantic versioning (semver)](http://semver.org/).

* **[v0.2.0](https://github.com/mklement0/whichpm/compare/v0.1.8...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](https://github.com/mklement0/whichpm/compare/v0.1.7...v0.1.8)** (2020-01-14):
* [doc] Read-me improvements.
* [dev] Dev dependencies updated.

* **[v0.1.7](https://github.com/mklement0/whichpm/compare/v0.1.6...v0.1.7)** (2015-09-16):
* [doc] man page improvements.

* **[v0.1.6](https://github.com/mklement0/whichpm/compare/v0.1.5...v0.1.6)** (2015-09-16):
* [doc] man page improvements.

* **[v0.1.5](https://github.com/mklement0/whichpm/compare/v0.1.4...v0.1.5)** (2015-09-15):
* [dev] Makefile improvements; various other behind-the-scenes tweaks.

* **[v0.1.4](https://github.com/mklement0/whichpm/compare/v0.1.3...v0.1.4)** (2015-09-03):
* [dev] Missing dev. dependency marked-man added.

* **[v0.1.3](https://github.com/mklement0/whichpm/compare/v0.1.2...v0.1.3)** (2015-09-02):
* [doc] Formatting error in man page corrected.

* **[v0.1.2](https://github.com/mklement0/whichpm/compare/v0.1.1...v0.1.2)** (2015-09-02):
* [fix] Fixed too-permissive check for the `-h` / `--help` option.

* **[v0.1.1](https://github.com/mklement0/whichpm/compare/v0.1.0...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.