Perl CPAN

The cpan client of the Comprehensive Perl Archive Network (https://www.cpan.org).

The tracked version is CPAN.pm’s library version, not the cpan script version printed on the same line.

Installs may require sudo when using the system Perl; local::lib gives user-local installs instead. cpan cannot uninstall a module, so no remove operation is declared.

Platforms

  • 🅱️ BSD

  • 🐧 Linux

  • 🍎 macOS

  • ⨂ Unix

  • 🪟 Windows

Operations

Operation

Supported

installed

outdated

search

install

upgrade

upgrade_all

remove

sync

cleanup

Ecosystem

  • Accepted purl types: pkg:cpan

Usage

$ mpm --cpan installed
$ mpm --cpan upgrade --all
$ mpm install pkg:cpan/hello
$ mpm --dry-run --cpan upgrade --all

Every example above accepts --dry-run, which simulates the underlying manager calls without touching the system: the safe way to watch what mpm would do before trusting it.

Deselect the manager for a single run with --no-cpan, disable it from your configuration, or tune its invocation attributes with per-manager overrides.

Command line

  • CLI names, in lookup order: cpan

  • Environment forced on each call:

    • PERL_MM_USE_DEFAULT=1

The version is probed by running:

$ cpan -v
>(info): /usr/bin/cpan script version 1.676, CPAN.pm version 2.28

and extracted with:

r"CPAN\.pm\s+version\s+(?P<version>\S+)"

Privilege escalation

mpm runs this manager as the current user and never prepends sudo by default. Flip the policy for its privileged operations with --sudo or the per-manager sudo override.

None of its operations needs root.

See privilege escalation for the full policy.

Cooldown

State of Perl CPAN’s release-age gating, from the cooldown support table:

  • Status: ❌ None

With --cooldown set, mpm skips this manager’s install and upgrade operations rather than run them unguarded (fail-closed); --allow-unsupported-managers opts back in.

Reference traces

Raw native outputs captured in the bundled definition: the reference mpm’s parsers were written against. If you know Perl CPAN well and a transcript below looks wrong, or a newer release changed its output format, report it.

$ cpan -l
Loading internal logger. Log::Log4perl recommended for better logging
O	1.03
Errno	1.33
Encode	3.08_01
meta_notation	undef
$ cpan -O
Loading internal logger. Log::Log4perl recommended for better logging
Reading '/Users/kde/.cpan/Metadata'
  Database was generated on Thu, 26 Mar 2026 13:41:03 GMT
Module Name                                Local    CPAN
---------------------------------------------------------------
Algorithm::C3                             0.1000  0.1100
Archive::Tar                              2.3800  3.0400