LinuxCommandLibrary

instmodsh

Manipulate and query installed modules

SYNOPSIS

instmodsh [options] ModuleName

PARAMETERS

ModuleName
    The name of the Perl module to check for. This is a required parameter.

-r | --raw
    Output the raw result of the module check (0 for installed, 1 for not installed).

-v | --version
    Also determine and output the version of the installed module, if available.

-a | --all
    Check for all modules and print to standard output with installation directory and version number

-i | --install_dir
    Display the installation directory of the Perl modules.

DESCRIPTION

The `instmodsh` command is a utility designed to simplify the management of installed Perl modules from within shell scripts. It provides a consistent and reliable way to determine which Perl modules are installed on a system, regardless of the underlying Perl installation method (e.g., system Perl, perlbrew, plenv).
Its primary function is to generate shell-compatible code snippets that can be sourced within a shell script. These code snippets set shell variables that indicate whether a particular module is installed and, optionally, its version. This eliminates the need for complex and error-prone manual parsing of Perl module lists or output from Perl commands within shell scripts. This command is mostly used for automated installation/dependency check scripts.

The command relies on the Perl `Module::Installed` module. Therefore, `Module::Installed` (or equivalent) must be installed and available in the Perl environment for `instmodsh` to function correctly. It primarily focuses on providing a shell environment that reflects Perl module installations, streamlining automation tasks that depend on specific module availability.

CAVEATS

Requires the `Module::Installed` Perl module (or equivalent) to be installed and available. The output format is designed for sourcing within Bourne-compatible shells. In case of multiple perl installations, the command can return unpredictable results.

USAGE EXAMPLE

Example usage:
instmodsh My::Module
This will generate shell code that can be sourced to set variables indicating whether `My::Module` is installed.
instmodsh -v My::Module
This will provide information on version also.

EXIT STATUS

The command returns an exit status of 0 if the module is found and 1 if it's not found or an error occurs.

SEE ALSO

perl(1), cpan(1), cpanm(1)

Copied to clipboard