Forge Home

cpanm

Manage perl modules with cpanminus

12,051 downloads

251 latest version

3.1 quality score

Version information

  • 0.9.12 (latest)
  • 0.9.11
  • 0.9.10
  • 0.9.9
  • 0.9.8
  • 0.9.7 (deleted)
  • 0.9.6
  • 0.9.5
  • 0.9.4
  • 0.9.3
  • 0.9.2
  • 0.9.1
  • 0.9.0 (deleted)
released Oct 13th 2021
This version is compatible with:
  • RedHat
    ,
    Debian

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'jamesmcdonald-cpanm', '0.9.12'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add jamesmcdonald-cpanm
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install jamesmcdonald-cpanm --version 0.9.12

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

jamesmcdonald/cpanm — version 0.9.12 Oct 13th 2021

cpanm

Table of Contents

  1. Description
  2. Setup - The basics of getting started with cpanm
  3. Usage - Configuration options and additional functionality
  4. Reference - An under-the-hood peek at what the module is doing and how
  5. Limitations - OS compatibility, etc.
  6. Development - Guide for contributing to the module

Description

The cpanm module manages CPAN packages using the cpanminus package. It exists to provide a simple way to install CPAN modules with the option to not run test suites. The intent is that it should work with Debianish and Redhatty distributions.

The module provides a class cpanm which will install Perl components, gcc, make and cpanminus itself. It also provides a resource type cpanm which you can use to manage modules in more or less the same way as package works.

Setup

What cpanm affects

This module will currently automatically install the following packages:

  • perl
  • gcc
  • make
  • perl-core on RHEL6-7

These are installed using ensure_packages, so shouldn't cause conflicts if you have them managed elsewhere.

It will also install cpanm itself in a standard directory, generally /usr/bin or /usr/local/bin and a copy of cpanm used for bootstrapping in /var/cache/cpanm-install.

Setup Requirements

This module contains a custom type, so you must make sure pluginsync is enabled if you are using a puppet master.

Beginning with cpanm

include cpanm

cpanm {'CGI':
  ensure => latest,
}

Usage

Both the cpanm class and resource support a mirror parameter to control which CPAN archive packages are fetched from. The cpanm resource supports additional parameters, test and force, to enable CPAN tests and force CPAN installation respectively.

Reference

The cpanm class currently supports the following parameters:

  • mirror A CPAN mirror to use to retrieve App::cpanminus. This is passed to cpanm as --from, meaning that only this mirror will be used.

  • lwpbootstrap Option to pass --no-lwp in the bootstrap command. Default: false.

The cpanm resource supports:

  • ensure absent, present or latest.

  • force Pass the '-f' (force) option to CPAN installation. Boolean, default is false. This only has an effect on installation or upgrade. It does nothing unless the value of ensure causes a change to be made.

  • mirror A CPAN mirror to use to retrieve packages. This is passed to cpanm as --from, meaning that only this mirror will be used.

  • test Run CPAN tests. Boolean, default is false.

The module contains a copy of cpanminus, which is used to bootstrap installing itself.

Limitations

The module is tested on RHEL 5-7 and Debian Jessie and Stretch. It should work properly in those environments, but it is relatively simple, so it may well work in similar environments without modification. If you need specific changes for your environment, feel free to send them!

Known Issues

The listing of installed CPAN modules is based on perldoc perllocal. This generally works well, but doesn't get updated when you remove a CPAN module.

Development

If you make improvements or fixes, please feel free to send a PR on Github. This module exists to solve a specific problem for me, but I'm quite happy to extend it to support other people's use cases.

Contributors

This module contains a copy of cpanminus retrieved from https://cpanmin.us. App::cpanminus is written by Tatsuhiko Miyagawa and distributed under the same terms as Perl. You can read more details about contributors via the link.