Forge Home

cpanm

Manage perl modules with cpanminus

16,663 downloads

373 latest version

3.1 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 0.9.17 (latest)
  • 0.9.16
  • 0.9.15
  • 0.9.14 (deleted)
  • 0.9.13
  • 0.9.12
  • 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 Jun 1st 2023
This version is compatible with:
  • ,
This module has been deprecated by its author since Apr 17th 2024.

The author has suggested puppet-cpanm as its replacement.

Start using this module

Documentation

jamesmcdonald/cpanm — version 0.9.17 Jun 1st 2023

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.