CINXE.COM
cpan - easily interact with CPAN from the command line - Perldoc Browser
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>cpan - easily interact with CPAN from the command line - Perldoc Browser</title> <link rel="search" href="/opensearch.xml" type="application/opensearchdescription+xml" title="Perldoc Browser"> <link rel="canonical" href="https://perldoc.perl.org/cpan"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/stackoverflow-light.min.css" integrity="sha512-cG1IdFxqipi3gqLmksLtuk13C+hBa57a6zpWxMeoY3Q9O6ooFxq50DayCdm0QrDgZjMUn23z/0PMZlgft7Yp5Q==" crossorigin="anonymous" /> <style> body { background: #f4f4f5; color: #020202; } .navbar-dark { background-image: -webkit-linear-gradient(top, #005f85 0, #002e49 100%); background-image: -o-linear-gradient(top, #005f85 0, #002e49 100%); background-image: linear-gradient(to bottom, #005f85 0, #002e49 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff005f85', endColorstr='#ff002e49', GradientType=0); background-repeat: repeat-x; } .navbar-dark .navbar-nav .nav-link, .navbar-dark .navbar-nav .nav-link:focus { color: #fff } .navbar-dark .navbar-nav .nav-link:hover { color: #ffef68 } #wrapperlicious { margin: 0 auto; font: 0.9em 'Helvetica Neue', Helvetica, sans-serif; font-weight: normal; line-height: 1.5em; margin: 0; padding: 0; } #wrapperlicious h1 { font-size: 1.5em } #wrapperlicious h2 { font-size: 1.3em } #wrapperlicious h3 { font-size: 1.1em } #wrapperlicious h4 { font-size: 0.9em } #wrapperlicious h1, #wrapperlicious h2, #wrapperlicious h3, #wrapperlicious h4, #wrapperlicious dt { color: #020202; margin-top: 1em; margin-bottom: 1em; position: relative; font-weight: bold; } #wrapperlicious a { color: inherit; text-decoration: underline } #wrapperlicious #toc { text-decoration: none } #wrapperlicious a:hover { color: #2a2a2a } #wrapperlicious a img { border: 0 } #wrapperlicious :not(pre) > code { color: inherit; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px; font: 0.9em Consolas, Menlo, Monaco, monospace; padding: 0.3em; } #wrapperlicious dd { margin: 0; margin-left: 2em; } #wrapperlicious dt { color: #2a2a2a; font-weight: bold; margin-left: 0.9em; } #wrapperlicious p { margin-bottom: 1em; margin-top: 1em; } #wrapperlicious li > p { margin-bottom: 0; margin-top: 0; } #wrapperlicious pre { border: 1px solid #c1c1c1; border-radius: 3px; font: 100% Consolas, Menlo, Monaco, monospace; margin-bottom: 1em; margin-top: 1em; } #wrapperlicious pre > code { display: block; background-color: #f6f6f6; font: 0.9em Consolas, Menlo, Monaco, monospace; line-height: 1.5em; text-align: left; white-space: pre; padding: 1em; } #wrapperlicious dl, #wrapperlicious ol, #wrapperlicious ul { margin-bottom: 1em; margin-top: 1em; } #wrapperlicious ul { list-style-type: square; } #wrapperlicious ul ul { margin-bottom: 0px; margin-top: 0px; } #footer { font-size: 0.8em; padding-top: 0.5em; text-align: center; } #more { display: inline; font-size: 0.8em; } #perldocdiv { background-color: #fff; border: 1px solid #c1c1c1; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; margin-left: auto; margin-right: auto; padding: 3em; padding-top: 1em; max-width: 960px; } #moduleversion { float: right } #wrapperlicious .leading-notice { font-style: italic; padding-left: 1em; margin-top: 1em; margin-bottom: 1em; } #wrapperlicious .permalink { display: none; left: -0.75em; position: absolute; padding-right: 0.25em; text-decoration: none; } #wrapperlicious h1:hover .permalink, #wrapperlicious h2:hover .permalink, #wrapperlicious h3:hover .permalink, #wrapperlicious h4:hover .permalink, #wrapperlicious dt:hover .permalink { display: block; } </style> <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-KVNWBNT5FB"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-KVNWBNT5FB'); gtag('config', 'UA-50555-3'); </script> </head> <body> <nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-between"> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <a class="navbar-brand" href="/"><img src="/images/perl_camel_30.png" width="30" height="30" class="d-inline-block align-top" alt="Perl Camel Logo"> Perldoc Browser</a> <div class="collapse navbar-collapse" id="navbarNav"> <ul class="navbar-nav mr-auto"> <li class="nav-item dropdown text-nowrap"> <a class="nav-link dropdown-toggle" href="#" id="dropdownlink-stable" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">5.41.9</a> <div class="dropdown-menu" aria-labelledby="dropdownlink-stable"> <a class="dropdown-item" href="/cpan">Latest</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.40.1/cpan">5.40.1</a> <a class="dropdown-item" href="/5.40.0/cpan">5.40.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.38.3/cpan">5.38.3</a> <a class="dropdown-item" href="/5.38.2/cpan">5.38.2</a> <a class="dropdown-item" href="/5.38.1/cpan">5.38.1</a> <a class="dropdown-item" href="/5.38.0/cpan">5.38.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.36.3/cpan">5.36.3</a> <a class="dropdown-item" href="/5.36.2/cpan">5.36.2</a> <a class="dropdown-item" href="/5.36.1/cpan">5.36.1</a> <a class="dropdown-item" href="/5.36.0/cpan">5.36.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.34.3/cpan">5.34.3</a> <a class="dropdown-item" href="/5.34.2/cpan">5.34.2</a> <a class="dropdown-item" href="/5.34.1/cpan">5.34.1</a> <a class="dropdown-item" href="/5.34.0/cpan">5.34.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.32.1/cpan">5.32.1</a> <a class="dropdown-item" href="/5.32.0/cpan">5.32.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.30.3/cpan">5.30.3</a> <a class="dropdown-item" href="/5.30.2/cpan">5.30.2</a> <a class="dropdown-item" href="/5.30.1/cpan">5.30.1</a> <a class="dropdown-item" href="/5.30.0/cpan">5.30.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.28.3/cpan">5.28.3</a> <a class="dropdown-item" href="/5.28.2/cpan">5.28.2</a> <a class="dropdown-item" href="/5.28.1/cpan">5.28.1</a> <a class="dropdown-item" href="/5.28.0/cpan">5.28.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.26.3/cpan">5.26.3</a> <a class="dropdown-item" href="/5.26.2/cpan">5.26.2</a> <a class="dropdown-item" href="/5.26.1/cpan">5.26.1</a> <a class="dropdown-item" href="/5.26.0/cpan">5.26.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.24.4/cpan">5.24.4</a> <a class="dropdown-item" href="/5.24.3/cpan">5.24.3</a> <a class="dropdown-item" href="/5.24.2/cpan">5.24.2</a> <a class="dropdown-item" href="/5.24.1/cpan">5.24.1</a> <a class="dropdown-item" href="/5.24.0/cpan">5.24.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.22.4/cpan">5.22.4</a> <a class="dropdown-item" href="/5.22.3/cpan">5.22.3</a> <a class="dropdown-item" href="/5.22.2/cpan">5.22.2</a> <a class="dropdown-item" href="/5.22.1/cpan">5.22.1</a> <a class="dropdown-item" href="/5.22.0/cpan">5.22.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.20.3/cpan">5.20.3</a> <a class="dropdown-item" href="/5.20.2/cpan">5.20.2</a> <a class="dropdown-item" href="/5.20.1/cpan">5.20.1</a> <a class="dropdown-item" href="/5.20.0/cpan">5.20.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.18.4/cpan">5.18.4</a> <a class="dropdown-item" href="/5.18.3/cpan">5.18.3</a> <a class="dropdown-item" href="/5.18.2/cpan">5.18.2</a> <a class="dropdown-item" href="/5.18.1/cpan">5.18.1</a> <a class="dropdown-item" href="/5.18.0/cpan">5.18.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.16.3/cpan">5.16.3</a> <a class="dropdown-item" href="/5.16.2/cpan">5.16.2</a> <a class="dropdown-item" href="/5.16.1/cpan">5.16.1</a> <a class="dropdown-item" href="/5.16.0/cpan">5.16.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.14.4/cpan">5.14.4</a> <a class="dropdown-item" href="/5.14.3/cpan">5.14.3</a> <a class="dropdown-item" href="/5.14.2/cpan">5.14.2</a> <a class="dropdown-item" href="/5.14.1/cpan">5.14.1</a> <a class="dropdown-item" href="/5.14.0/cpan">5.14.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.12.5/cpan">5.12.5</a> <a class="dropdown-item" href="/5.12.4/cpan">5.12.4</a> <a class="dropdown-item" href="/5.12.3/cpan">5.12.3</a> <a class="dropdown-item" href="/5.12.2/cpan">5.12.2</a> <a class="dropdown-item" href="/5.12.1/cpan">5.12.1</a> <a class="dropdown-item" href="/5.12.0/cpan">5.12.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.10.1/cpan">5.10.1</a> <a class="dropdown-item" href="/5.10.0/cpan">5.10.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.8.9/cpan">5.8.9</a> <a class="dropdown-item" href="/5.8.8/cpan">5.8.8</a> <a class="dropdown-item" href="/5.8.7/cpan">5.8.7</a> <a class="dropdown-item" href="/5.8.6/cpan">5.8.6</a> <a class="dropdown-item" href="/5.8.5/cpan">5.8.5</a> <a class="dropdown-item" href="/5.8.4/cpan">5.8.4</a> <a class="dropdown-item" href="/5.8.3/cpan">5.8.3</a> <a class="dropdown-item" href="/5.8.2/cpan">5.8.2</a> <a class="dropdown-item" href="/5.8.1/cpan">5.8.1</a> <a class="dropdown-item" href="/5.8.0/cpan">5.8.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.6.2/cpan">5.6.2</a> <a class="dropdown-item" href="/5.6.1/cpan">5.6.1</a> <a class="dropdown-item" href="/5.6.0/cpan">5.6.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.005_04/cpan">5.005_04</a> <a class="dropdown-item" href="/5.005_03/cpan">5.005_03</a> <a class="dropdown-item" href="/5.005_02/cpan">5.005_02</a> <a class="dropdown-item" href="/5.005_01/cpan">5.005_01</a> <a class="dropdown-item" href="/5.005/cpan">5.005</a> </div> </li> <li class="nav-item dropdown text-nowrap"> <a class="nav-link dropdown-toggle" href="#" id="dropdownlink-dev" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dev</a> <div class="dropdown-menu" aria-labelledby="dropdownlink-dev"> <a class="dropdown-item" href="/blead/cpan">blead</a> <a class="dropdown-item" href="/5.41.10/cpan">5.41.10</a> <a class="dropdown-item active" href="/5.41.9/cpan">5.41.9</a> <a class="dropdown-item" href="/5.41.8/cpan">5.41.8</a> <a class="dropdown-item" href="/5.41.7/cpan">5.41.7</a> <a class="dropdown-item" href="/5.41.6/cpan">5.41.6</a> <a class="dropdown-item" href="/5.41.5/cpan">5.41.5</a> <a class="dropdown-item" href="/5.41.4/cpan">5.41.4</a> <a class="dropdown-item" href="/5.41.3/cpan">5.41.3</a> <a class="dropdown-item" href="/5.41.2/cpan">5.41.2</a> <a class="dropdown-item" href="/5.41.1/cpan">5.41.1</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.40.1-RC1/cpan">5.40.1-RC1</a> <a class="dropdown-item" href="/5.40.0-RC2/cpan">5.40.0-RC2</a> <a class="dropdown-item" href="/5.40.0-RC1/cpan">5.40.0-RC1</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.39.10/cpan">5.39.10</a> <a class="dropdown-item" href="/5.39.9/cpan">5.39.9</a> <a class="dropdown-item" href="/5.39.8/cpan">5.39.8</a> <a class="dropdown-item" href="/5.39.7/cpan">5.39.7</a> <a class="dropdown-item" href="/5.39.6/cpan">5.39.6</a> <a class="dropdown-item" href="/5.39.5/cpan">5.39.5</a> <a class="dropdown-item" href="/5.39.4/cpan">5.39.4</a> <a class="dropdown-item" href="/5.39.3/cpan">5.39.3</a> <a class="dropdown-item" href="/5.39.2/cpan">5.39.2</a> <a class="dropdown-item" href="/5.39.1/cpan">5.39.1</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.38.3-RC1/cpan">5.38.3-RC1</a> </div> </li> <li class="nav-item dropdown text-nowrap"> <a class="nav-link dropdown-toggle" href="#" id="dropdownlink-nav" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a> <div class="dropdown-menu" aria-labelledby="dropdownlink-nav"> <a class="dropdown-item" href="/5.41.9/perl">Perl</a> <a class="dropdown-item" href="/5.41.9/perlintro">Intro</a> <a class="dropdown-item" href="/5.41.9/perl#Tutorials">Tutorials</a> <a class="dropdown-item" href="/5.41.9/perlfaq">FAQs</a> <a class="dropdown-item" href="/5.41.9/perl#Reference-Manual">Reference</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.41.9/perlop">Operators</a> <a class="dropdown-item" href="/5.41.9/functions">Functions</a> <a class="dropdown-item" href="/5.41.9/variables">Variables</a> <a class="dropdown-item" href="/5.41.9/modules">Modules</a> <a class="dropdown-item" href="/5.41.9/perlutil">Utilities</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.41.9/perldelta">Release Notes</a> <a class="dropdown-item" href="/5.41.9/perlcommunity">Community</a> <a class="dropdown-item" href="/5.41.9/perlhist">History</a> </div> </li> </ul> <ul class="navbar-nav"> <script> function set_expand (expand) { var perldocdiv = document.getElementById('perldocdiv'); var width = window.getComputedStyle(perldocdiv).getPropertyValue('max-width'); var expanded = (width == '' || width == 'none') ? true : false; if (expand === null) { expand = !expanded; } if ((expand && !expanded) || (!expand && expanded)) { perldocdiv.style.setProperty('max-width', expand ? 'none' : '960px'); var button_classlist = document.getElementById('content-expand-button').classList; if (expand) { button_classlist.add('btn-light'); button_classlist.remove('btn-outline-light'); } else { button_classlist.add('btn-outline-light'); button_classlist.remove('btn-light'); } } return expand; } function toggle_expand () { var expand = set_expand(null); document.cookie = 'perldoc_expand=' + (expand ? 1 : 0) + '; path=/; expires=Tue, 19 Jan 2038 03:14:07 UTC'; } function read_expand () { return document.cookie.split(';').some(function (item) { return item.indexOf('perldoc_expand=1') >= 0 }); } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', function () { if (read_expand()) { set_expand(true); } }); } else if (read_expand()) { set_expand(true); } </script> <button id="content-expand-button" type="button" class="btn btn-outline-light d-none d-lg-inline-block mr-4" onclick="toggle_expand()">Expand</button> </ul> <form class="form-inline" method="get" action="/5.41.9/search"> <input class="form-control mr-3" type="search" name="q" placeholder="Search" aria-label="Search" value=""> </form> </div> </nav> <div id="wrapperlicious" class="container-fluid"> <div id="perldocdiv"> <div id="links"> <a href="/5.41.9/cpan">cpan</a> <div id="more"> (<a href="/5.41.9/cpan.txt">source</a>, <a href="https://metacpan.org/pod/cpan">CPAN</a>) </div> </div> <div class="leading-notice"> You are viewing the version of this documentation from Perl 5.41.9. This is a development version of Perl. </div> <h1><a id="toc">CONTENTS</a></h1> <ul> <li> <a class="text-decoration-none" href="#NAME">NAME</a> </li> <li> <a class="text-decoration-none" href="#SYNOPSIS">SYNOPSIS</a> </li> <li> <a class="text-decoration-none" href="#DESCRIPTION">DESCRIPTION</a> <ul> <li> <a class="text-decoration-none" href="#Options">Options</a> </li> <li> <a class="text-decoration-none" href="#Examples">Examples</a> </li> <li> <a class="text-decoration-none" href="#Environment-variables">Environment variables</a> </li> </ul> </li> <li> <a class="text-decoration-none" href="#EXIT-VALUES">EXIT VALUES</a> </li> <li> <a class="text-decoration-none" href="#TO-DO">TO DO</a> </li> <li> <a class="text-decoration-none" href="#BUGS">BUGS</a> </li> <li> <a class="text-decoration-none" href="#SEE-ALSO">SEE ALSO</a> </li> <li> <a class="text-decoration-none" href="#SOURCE-AVAILABILITY">SOURCE AVAILABILITY</a> </li> <li> <a class="text-decoration-none" href="#CREDITS">CREDITS</a> </li> <li> <a class="text-decoration-none" href="#AUTHOR">AUTHOR</a> </li> <li> <a class="text-decoration-none" href="#COPYRIGHT">COPYRIGHT</a> </li> </ul> <h1 id="NAME"><a class="permalink" href="#NAME">#</a>NAME</h1> <p>cpan - easily interact with CPAN from the command line</p> <h1 id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">#</a>SYNOPSIS</h1> <pre><code class="plaintext"># with arguments and no switches, installs specified modules cpan module_name [ module_name ... ] # with switches, installs modules with extra behavior cpan [-cfFimtTw] module_name [ module_name ... ] # use local::lib cpan -I module_name [ module_name ... ] # one time mirror override for faster mirrors cpan -p ... # with just the dot, install from the distribution in the # current directory cpan . # without arguments, starts CPAN.pm shell cpan # without arguments, but some switches cpan [-ahpruvACDLOPX]</code></pre> <h1 id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">#</a>DESCRIPTION</h1> <p>This script provides a command interface (not a shell) to CPAN. At the moment it uses CPAN.pm to do the work, but it is not a one-shot command runner for CPAN.pm.</p> <h2 id="Options"><a class="permalink" href="#Options">#</a>Options</h2> <dl> <dt id="-a"><a class="permalink" href="#-a">#</a><a id="a"></a>-a</dt> <dd> <p>Creates a CPAN.pm autobundle with CPAN::Shell->autobundle.</p> </dd> <dt id="-A-module-[-module-...-]"><a class="permalink" href="#-A-module-%5B-module-...-%5D">#</a><a id="A-module-module"></a>-A module [ module ... ]</dt> <dd> <p>Shows the primary maintainers for the specified modules.</p> </dd> <dt id="-c-module"><a class="permalink" href="#-c-module">#</a><a id="c-module"></a>-c module</dt> <dd> <p>Runs a `make clean` in the specified module's directories.</p> </dd> <dt id="-C-module-[-module-...-]"><a class="permalink" href="#-C-module-%5B-module-...-%5D">#</a><a id="C-module-module"></a>-C module [ module ... ]</dt> <dd> <p>Show the <i>Changes</i> files for the specified modules</p> </dd> <dt id="-D-module-[-module-...-]"><a class="permalink" href="#-D-module-%5B-module-...-%5D">#</a><a id="D-module-module"></a>-D module [ module ... ]</dt> <dd> <p>Show the module details. This prints one line for each out-of-date module (meaning, modules locally installed but have newer versions on CPAN). Each line has three columns: module name, local version, and CPAN version.</p> </dd> <dt id="-f"><a class="permalink" href="#-f">#</a><a id="f"></a>-f</dt> <dd> <p>Force the specified action, when it normally would have failed. Use this to install a module even if its tests fail. When you use this option, -i is not optional for installing a module when you need to force it:</p> <pre><code class="plaintext">% cpan -f -i Module::Foo</code></pre> </dd> <dt id="-F"><a class="permalink" href="#-F">#</a><a id="F"></a>-F</dt> <dd> <p>Turn off CPAN.pm's attempts to lock anything. You should be careful with this since you might end up with multiple scripts trying to muck in the same directory. This isn't so much of a concern if you're loading a special config with <code>-j</code>, and that config sets up its own work directories.</p> </dd> <dt id="-g-module-[-module-...-]"><a class="permalink" href="#-g-module-%5B-module-...-%5D">#</a><a id="g-module-module"></a>-g module [ module ... ]</dt> <dd> <p>Downloads to the current directory the latest distribution of the module.</p> </dd> <dt id="-G-module-[-module-...-]"><a class="permalink" href="#-G-module-%5B-module-...-%5D">#</a><a id="G-module-module"></a>-G module [ module ... ]</dt> <dd> <p>UNIMPLEMENTED</p> <p>Download to the current directory the latest distribution of the modules, unpack each distribution, and create a git repository for each distribution.</p> <p>If you want this feature, check out Yanick Champoux's <code>Git::CPAN::Patch</code> distribution.</p> </dd> <dt id="-h"><a class="permalink" href="#-h">#</a><a id="h"></a>-h</dt> <dd> <p>Print a help message and exit. When you specify <code>-h</code>, it ignores all of the other options and arguments.</p> </dd> <dt id="-i-module-[-module-...-]"><a class="permalink" href="#-i-module-%5B-module-...-%5D">#</a><a id="i-module-module"></a>-i module [ module ... ]</dt> <dd> <p>Install the specified modules. With no other switches, this switch is implied.</p> </dd> <dt id="-I"><a class="permalink" href="#-I">#</a><a id="I"></a>-I</dt> <dd> <p>Load <code>local::lib</code> (think like <code>-I</code> for loading lib paths). Too bad <code>-l</code> was already taken.</p> </dd> <dt id="-j-Config.pm"><a class="permalink" href="#-j-Config.pm">#</a><a id="j-Config.pm"></a>-j Config.pm</dt> <dd> <p>Load the file that has the CPAN configuration data. This should have the same format as the standard <i>CPAN/Config.pm</i> file, which defines <code>$CPAN::Config</code> as an anonymous hash.</p> </dd> <dt id="-J"><a class="permalink" href="#-J">#</a><a id="J"></a>-J</dt> <dd> <p>Dump the configuration in the same format that CPAN.pm uses. This is useful for checking the configuration as well as using the dump as a starting point for a new, custom configuration.</p> </dd> <dt id="-l"><a class="permalink" href="#-l">#</a><a id="l"></a>-l</dt> <dd> <p>List all installed modules with their versions</p> </dd> <dt id="-L-author-[-author-...-]"><a class="permalink" href="#-L-author-%5B-author-...-%5D">#</a><a id="L-author-author"></a>-L author [ author ... ]</dt> <dd> <p>List the modules by the specified authors.</p> </dd> <dt id="-m"><a class="permalink" href="#-m">#</a><a id="m"></a>-m</dt> <dd> <p>Make the specified modules.</p> </dd> <dt id="-M-mirror1,mirror2,..."><a class="permalink" href="#-M-mirror1,mirror2,...">#</a><a id="M-mirror1-mirror2"></a>-M mirror1,mirror2,...</dt> <dd> <p>A comma-separated list of mirrors to use for just this run. The <code>-P</code> option can find them for you automatically.</p> </dd> <dt id="-n"><a class="permalink" href="#-n">#</a><a id="n"></a>-n</dt> <dd> <p>Do a dry run, but don't actually install anything. (unimplemented)</p> </dd> <dt id="-O"><a class="permalink" href="#-O">#</a><a id="O"></a>-O</dt> <dd> <p>Show the out-of-date modules.</p> </dd> <dt id="-p"><a class="permalink" href="#-p">#</a><a id="p"></a>-p</dt> <dd> <p>Ping the configured mirrors and print a report</p> </dd> <dt id="-P"><a class="permalink" href="#-P">#</a><a id="P"></a>-P</dt> <dd> <p>Find the best mirrors you could be using and use them for the current session.</p> </dd> <dt id="-r"><a class="permalink" href="#-r">#</a><a id="r"></a>-r</dt> <dd> <p>Recompiles dynamically loaded modules with CPAN::Shell->recompile.</p> </dd> <dt id="-s"><a class="permalink" href="#-s">#</a><a id="s"></a>-s</dt> <dd> <p>Drop in the CPAN.pm shell. This command does this automatically if you don't specify any arguments.</p> </dd> <dt id="-t-module-[-module-...-]"><a class="permalink" href="#-t-module-%5B-module-...-%5D">#</a><a id="t-module-module"></a>-t module [ module ... ]</dt> <dd> <p>Run a `make test` on the specified modules.</p> </dd> <dt id="-T"><a class="permalink" href="#-T">#</a><a id="T"></a>-T</dt> <dd> <p>Do not test modules. Simply install them.</p> </dd> <dt id="-u"><a class="permalink" href="#-u">#</a><a id="u"></a>-u</dt> <dd> <p>Upgrade all installed modules. Blindly doing this can really break things, so keep a backup.</p> </dd> <dt id="-v"><a class="permalink" href="#-v">#</a><a id="v"></a>-v</dt> <dd> <p>Print the script version and CPAN.pm version then exit.</p> </dd> <dt id="-V"><a class="permalink" href="#-V">#</a><a id="V"></a>-V</dt> <dd> <p>Print detailed information about the cpan client.</p> </dd> <dt id="-w"><a class="permalink" href="#-w">#</a><a id="w"></a>-w</dt> <dd> <p>UNIMPLEMENTED</p> <p>Turn on cpan warnings. This checks various things, like directory permissions, and tells you about problems you might have.</p> </dd> <dt id="-x-module-[-module-...-]"><a class="permalink" href="#-x-module-%5B-module-...-%5D">#</a><a id="x-module-module"></a>-x module [ module ... ]</dt> <dd> <p>Find close matches to the named modules that you think you might have mistyped. This requires the optional installation of Text::Levenshtein or Text::Levenshtein::Damerau.</p> </dd> <dt id="-X"><a class="permalink" href="#-X">#</a><a id="X"></a>-X</dt> <dd> <p>Dump all the namespaces to standard output.</p> </dd> </dl> <h2 id="Examples"><a class="permalink" href="#Examples">#</a>Examples</h2> <pre><code class="plaintext"># print a help message cpan -h # print the version numbers cpan -v # create an autobundle cpan -a # recompile modules cpan -r # upgrade all installed modules cpan -u # install modules ( sole -i is optional ) cpan -i Netscape::Booksmarks Business::ISBN # force install modules ( must use -i ) cpan -fi CGI::Minimal URI # install modules but without testing them cpan -Ti CGI::Minimal URI</code></pre> <h2 id="Environment-variables"><a class="permalink" href="#Environment-variables">#</a><a id="Environment"></a>Environment variables</h2> <p>There are several components in CPAN.pm that use environment variables. The build tools, <a href="/5.41.9/ExtUtils::MakeMaker">ExtUtils::MakeMaker</a> and <a href="/5.41.9/Module::Build">Module::Build</a> use some, while others matter to the levels above them. Some of these are specified by the Perl Toolchain Gang:</p> <p>Lancaster Consensus: <a href="https://github.com/Perl-Toolchain-Gang/toolchain-site/blob/master/lancaster-consensus.md">https://github.com/Perl-Toolchain-Gang/toolchain-site/blob/master/lancaster-consensus.md</a></p> <p>Oslo Consensus: <a href="https://github.com/Perl-Toolchain-Gang/toolchain-site/blob/master/oslo-consensus.md">https://github.com/Perl-Toolchain-Gang/toolchain-site/blob/master/oslo-consensus.md</a></p> <dl> <dt id="NONINTERACTIVE_TESTING"><a class="permalink" href="#NONINTERACTIVE_TESTING">#</a>NONINTERACTIVE_TESTING</dt> <dd> <p>Assume no one is paying attention and skips prompts for distributions that do that correctly. <code>cpan(1)</code> sets this to <code>1</code> unless it already has a value (even if that value is false).</p> </dd> <dt id="PERL_MM_USE_DEFAULT"><a class="permalink" href="#PERL_MM_USE_DEFAULT">#</a>PERL_MM_USE_DEFAULT</dt> <dd> <p>Use the default answer for a prompted questions. <code>cpan(1)</code> sets this to <code>1</code> unless it already has a value (even if that value is false).</p> </dd> <dt id="CPAN_OPTS"><a class="permalink" href="#CPAN_OPTS">#</a>CPAN_OPTS</dt> <dd> <p>As with <code>PERL5OPT</code>, a string of additional <code>cpan(1)</code> options to add to those you specify on the command line.</p> </dd> <dt id="CPANSCRIPT_LOGLEVEL"><a class="permalink" href="#CPANSCRIPT_LOGLEVEL">#</a>CPANSCRIPT_LOGLEVEL</dt> <dd> <p>The log level to use, with either the embedded, minimal logger or <a href="/5.41.9/Log::Log4perl">Log::Log4perl</a> if it is installed. Possible values are the same as the <code>Log::Log4perl</code> levels: <code>TRACE</code>, <code>DEBUG</code>, <code>INFO</code>, <code>WARN</code>, <code>ERROR</code>, and <code>FATAL</code>. The default is <code>INFO</code>.</p> </dd> <dt id="GIT_COMMAND"><a class="permalink" href="#GIT_COMMAND">#</a>GIT_COMMAND</dt> <dd> <p>The path to the <code>git</code> binary to use for the Git features. The default is <code>/usr/local/bin/git</code>.</p> </dd> </dl> <h1 id="EXIT-VALUES"><a class="permalink" href="#EXIT-VALUES">#</a><a id="EXIT"></a>EXIT VALUES</h1> <p>The script exits with zero if it thinks that everything worked, or a positive number if it thinks that something failed. Note, however, that in some cases it has to divine a failure by the output of things it does not control. For now, the exit codes are vague:</p> <pre><code class="plaintext">1 An unknown error 2 The was an external problem 4 There was an internal problem with the script 8 A module failed to install</code></pre> <h1 id="TO-DO"><a class="permalink" href="#TO-DO">#</a><a id="TO"></a>TO DO</h1> <p>* one shot configuration values from the command line</p> <h1 id="BUGS"><a class="permalink" href="#BUGS">#</a>BUGS</h1> <p>* none noted</p> <h1 id="SEE-ALSO"><a class="permalink" href="#SEE-ALSO">#</a><a id="SEE"></a>SEE ALSO</h1> <p>Most behaviour, including environment variables and configuration, comes directly from CPAN.pm.</p> <h1 id="SOURCE-AVAILABILITY"><a class="permalink" href="#SOURCE-AVAILABILITY">#</a><a id="SOURCE"></a>SOURCE AVAILABILITY</h1> <p>This code is in Github in the CPAN.pm repository:</p> <pre><code class="plaintext">https://github.com/andk/cpanpm</code></pre> <p>The source used to be tracked separately in another GitHub repo, but the canonical source is now in the above repo.</p> <h1 id="CREDITS"><a class="permalink" href="#CREDITS">#</a>CREDITS</h1> <p>Japheth Cleaver added the bits to allow a forced install (-f).</p> <p>Jim Brandt suggest and provided the initial implementation for the up-to-date and Changes features.</p> <p>Adam Kennedy pointed out that exit() causes problems on Windows where this script ends up with a .bat extension</p> <h1 id="AUTHOR"><a class="permalink" href="#AUTHOR">#</a>AUTHOR</h1> <p>brian d foy, <code><bdfoy@cpan.org></code></p> <h1 id="COPYRIGHT"><a class="permalink" href="#COPYRIGHT">#</a>COPYRIGHT</h1> <p>Copyright (c) 2001-2015, brian d foy, All Rights Reserved.</p> <p>You may redistribute this under the same terms as Perl itself.</p> </div> <div id="footer"> <p>Perldoc Browser is maintained by Dan Book (<a href="https://metacpan.org/author/DBOOK">DBOOK</a>). Please contact him via the <a href="https://github.com/Grinnz/perldoc-browser/issues">GitHub issue tracker</a> or <a href="mailto:dbook@cpan.org">email</a> regarding any issues with the site itself, search, or rendering of documentation.</p> <p>The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the <a href="https://github.com/Perl/perl5/issues">Perl issue tracker</a>, the <a href="https://lists.perl.org/list/perl5-porters.html">mailing list</a>, or <a href="https://kiwiirc.com/client/irc.perl.org/p5p">IRC</a> to report any issues with the contents or format of the documentation.</p> </div> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" integrity="sha512-ubuT8Z88WxezgSqf3RLuNi5lmjstiJcyezx34yIU2gAHonIi27Na7atqzUZCOoY4CExaoFumzOsFQ2Ch+I/HCw==" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script> <script src="/js/highlight.pack.js"></script> <script>hljs.highlightAll();</script> </body> </html>