Version information
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
cpanm
Table of Contents
- Description
- Setup - The basics of getting started with cpanm
- Usage - Configuration options and additional functionality
- Reference - An under-the-hood peek at what the module is doing and how
- Limitations - OS compatibility, etc.
- 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 tocpanm
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 ofensure
causes a change to be made. -
mirror
A CPAN mirror to use to retrieve packages. This is passed tocpanm
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.
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
Unreleased
0.9.17 - 2023-06-01
Changed
- Merged PR#15 from jfoche to support stdlib <9
0.9.16 - 2023-04-02
Changed
- Merged PR#14 (fixing #13) to fix checks for
@version
.
0.9.15 - 2023-03-21
Changed
- Merged PR#10 from jovandeginst to allow stdlib versions <8.
0.9.13 - 2022-04-20
Changed
- Fixed #11 from gremble regarding modules where detection of an
installed version failed. Use
Module::Metadata
to get this information more reliably.
0.9.12 - 2021-10-13
Changed
- Merged PR#10 from xiconfjs to allow
@version
in module names.
0.9.11 - 2021-07-16
Changed
- Merged PR#8 from martindemello to correctly check :force in Puppet 5.5.
0.9.10 - 2020-06-14
Changed
- Merged PR#7 from arpagon to change the top version limit for stdlib to <7.0.0 allowing the use of newer versions.
- Updated test fixtures to use stdlib 6.3.0.
0.9.9 - 2018-09-06
Added
- Merged PR#5 from treyormsbee to add lwpbootstrap option which allows
the bootstrap to be run with
--no-lwp
.
0.9.8 - 2018-05-26
Added
- Added this changelog.
- Updated bundled
cpanm
to 1.7044.
0.9.6 - 2018-05-26
Changed
- Fixed issue #3 where Perl modules that cannot be imported were reinstalled on every puppet run.
0.9.5 - 2018-05-25
Added
- Merged a PR from @dutsmiller using
ensure_packages
rather thanpackage
resources to avoid conflicts.
Changed
- Fixed an issue where modules with non-ASCII characters in their metadata
triggered a bug in old versions of
Encode
with incorrect locale settings. - Added a dependency on stdlib for the
ensure_packages
function. - Added Debian 9.0 to the supported OS list.
0.9.4 - 2017-03-27
Added
- Support for specifying a CPAN mirror with the
mirror
parameter. - Tests for both supported platforms, Debian and Red Hat.
Changed
- Fix examples to be compatible with Puppet 3.
- Clean up perllocal parsing.
- Update documentation.
0.9.3 - 2016-12-21
Changed
- Add OS support to module metadata.
0.9.2 - 2016-12-21
Removed
- Dependency on stdlib, which is not in use.
0.9.1 - 2016-12-21
Removed
- Debug output.
0.9.0 - 2016-12-21
Added
- Tests for the puppet code.
- Example manifests to test install, latest and remove.
Changed
- Support cpanm being installed in
/usr/local/bin
. - Add
perl-core
package on RHEL 6+. - Fix various errors.
- Update README.
- Change licence to Perl to be compatible with cpanminus itself.
0.1.0 - 2016-12-10
Added
- Initial code.
- Bundled a copy of cpanminus for bootstrapping.
Dependencies
- puppetlabs/stdlib (>=4.10.0 <9.0.0)