| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "App::Cpan 3perl" |
| 58 |
.TH App::Cpan 3perl 2025-11-16 "perl v5.40.1" "Perl Programmers Reference Guide" |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
App::Cpan \- easily interact with CPAN from the command line |
| 65 |
.SH SYNOPSIS |
| 66 |
.IX Header "SYNOPSIS" |
| 67 |
.Vb 2 |
| 68 |
\& # with arguments and no switches, installs specified modules |
| 69 |
\& cpan module_name [ module_name ... ] |
| 70 |
\& |
| 71 |
\& # with switches, installs modules with extra behavior |
| 72 |
\& cpan [\-cfFimtTw] module_name [ module_name ... ] |
| 73 |
\& |
| 74 |
\& # use local::lib |
| 75 |
\& cpan \-I module_name [ module_name ... ] |
| 76 |
\& |
| 77 |
\& # one time mirror override for faster mirrors |
| 78 |
\& cpan \-p ... |
| 79 |
\& |
| 80 |
\& # with just the dot, install from the distribution in the |
| 81 |
\& # current directory |
| 82 |
\& cpan . |
| 83 |
\& |
| 84 |
\& # without arguments, starts CPAN.pm shell |
| 85 |
\& cpan |
| 86 |
\& |
| 87 |
\& # without arguments, but some switches |
| 88 |
\& cpan [\-ahpruvACDLOPX] |
| 89 |
.Ve |
| 90 |
.SH DESCRIPTION |
| 91 |
.IX Header "DESCRIPTION" |
| 92 |
This script provides a command interface (not a shell) to CPAN. At the |
| 93 |
moment it uses CPAN.pm to do the work, but it is not a one-shot command |
| 94 |
runner for CPAN.pm. |
| 95 |
.SS Options |
| 96 |
.IX Subsection "Options" |
| 97 |
.IP \-a 4 |
| 98 |
.IX Item "-a" |
| 99 |
Creates a CPAN.pm autobundle with CPAN::Shell\->autobundle. |
| 100 |
.IP "\-A module [ module ... ]" 4 |
| 101 |
.IX Item "-A module [ module ... ]" |
| 102 |
Shows the primary maintainers for the specified modules. |
| 103 |
.IP "\-c module" 4 |
| 104 |
.IX Item "-c module" |
| 105 |
Runs a `make clean` in the specified module's directories. |
| 106 |
.IP "\-C module [ module ... ]" 4 |
| 107 |
.IX Item "-C module [ module ... ]" |
| 108 |
Show the \fIChanges\fR files for the specified modules |
| 109 |
.IP "\-D module [ module ... ]" 4 |
| 110 |
.IX Item "-D module [ module ... ]" |
| 111 |
Show the module details. This prints one line for each out-of-date module |
| 112 |
(meaning, modules locally installed but have newer versions on CPAN). |
| 113 |
Each line has three columns: module name, local version, and CPAN |
| 114 |
version. |
| 115 |
.IP \-f 4 |
| 116 |
.IX Item "-f" |
| 117 |
Force the specified action, when it normally would have failed. Use this |
| 118 |
to install a module even if its tests fail. When you use this option, |
| 119 |
\&\-i is not optional for installing a module when you need to force it: |
| 120 |
.Sp |
| 121 |
.Vb 1 |
| 122 |
\& % cpan \-f \-i Module::Foo |
| 123 |
.Ve |
| 124 |
.IP \-F 4 |
| 125 |
.IX Item "-F" |
| 126 |
Turn off CPAN.pm's attempts to lock anything. You should be careful with |
| 127 |
this since you might end up with multiple scripts trying to muck in the |
| 128 |
same directory. This isn't so much of a concern if you're loading a special |
| 129 |
config with \f(CW\*(C`\-j\*(C'\fR, and that config sets up its own work directories. |
| 130 |
.IP "\-g module [ module ... ]" 4 |
| 131 |
.IX Item "-g module [ module ... ]" |
| 132 |
Downloads to the current directory the latest distribution of the module. |
| 133 |
.IP "\-G module [ module ... ]" 4 |
| 134 |
.IX Item "-G module [ module ... ]" |
| 135 |
UNIMPLEMENTED |
| 136 |
.Sp |
| 137 |
Download to the current directory the latest distribution of the |
| 138 |
modules, unpack each distribution, and create a git repository for each |
| 139 |
distribution. |
| 140 |
.Sp |
| 141 |
If you want this feature, check out Yanick Champoux's \f(CW\*(C`Git::CPAN::Patch\*(C'\fR |
| 142 |
distribution. |
| 143 |
.IP \-h 4 |
| 144 |
.IX Item "-h" |
| 145 |
Print a help message and exit. When you specify \f(CW\*(C`\-h\*(C'\fR, it ignores all |
| 146 |
of the other options and arguments. |
| 147 |
.IP "\-i module [ module ... ]" 4 |
| 148 |
.IX Item "-i module [ module ... ]" |
| 149 |
Install the specified modules. With no other switches, this switch |
| 150 |
is implied. |
| 151 |
.IP \-I 4 |
| 152 |
.IX Item "-I" |
| 153 |
Load \f(CW\*(C`local::lib\*(C'\fR (think like \f(CW\*(C`\-I\*(C'\fR for loading lib paths). Too bad |
| 154 |
\&\f(CW\*(C`\-l\*(C'\fR was already taken. |
| 155 |
.IP "\-j Config.pm" 4 |
| 156 |
.IX Item "-j Config.pm" |
| 157 |
Load the file that has the CPAN configuration data. This should have the |
| 158 |
same format as the standard \fICPAN/Config.pm\fR file, which defines |
| 159 |
\&\f(CW$CPAN::Config\fR as an anonymous hash. |
| 160 |
.Sp |
| 161 |
If the file does not exist, \f(CW\*(C`cpan\*(C'\fR dies. |
| 162 |
.IP \-J 4 |
| 163 |
.IX Item "-J" |
| 164 |
Dump the configuration in the same format that CPAN.pm uses. This is useful |
| 165 |
for checking the configuration as well as using the dump as a starting point |
| 166 |
for a new, custom configuration. |
| 167 |
.IP \-l 4 |
| 168 |
.IX Item "-l" |
| 169 |
List all installed modules with their versions |
| 170 |
.IP "\-L author [ author ... ]" 4 |
| 171 |
.IX Item "-L author [ author ... ]" |
| 172 |
List the modules by the specified authors. |
| 173 |
.IP \-m 4 |
| 174 |
.IX Item "-m" |
| 175 |
Make the specified modules. |
| 176 |
.IP "\-M mirror1,mirror2,..." 4 |
| 177 |
.IX Item "-M mirror1,mirror2,..." |
| 178 |
A comma-separated list of mirrors to use for just this run. The \f(CW\*(C`\-P\*(C'\fR |
| 179 |
option can find them for you automatically. |
| 180 |
.IP \-n 4 |
| 181 |
.IX Item "-n" |
| 182 |
Do a dry run, but don't actually install anything. (unimplemented) |
| 183 |
.IP \-O 4 |
| 184 |
.IX Item "-O" |
| 185 |
Show the out-of-date modules. |
| 186 |
.IP \-p 4 |
| 187 |
.IX Item "-p" |
| 188 |
Ping the configured mirrors and print a report |
| 189 |
.IP \-P 4 |
| 190 |
.IX Item "-P" |
| 191 |
Find the best mirrors you could be using and use them for the current |
| 192 |
session. |
| 193 |
.IP \-r 4 |
| 194 |
.IX Item "-r" |
| 195 |
Recompiles dynamically loaded modules with CPAN::Shell\->recompile. |
| 196 |
.IP \-s 4 |
| 197 |
.IX Item "-s" |
| 198 |
Drop in the CPAN.pm shell. This command does this automatically if you don't |
| 199 |
specify any arguments. |
| 200 |
.IP "\-t module [ module ... ]" 4 |
| 201 |
.IX Item "-t module [ module ... ]" |
| 202 |
Run a `make test` on the specified modules. |
| 203 |
.IP \-T 4 |
| 204 |
.IX Item "-T" |
| 205 |
Do not test modules. Simply install them. |
| 206 |
.IP \-u 4 |
| 207 |
.IX Item "-u" |
| 208 |
Upgrade all installed modules. Blindly doing this can really break things, |
| 209 |
so keep a backup. |
| 210 |
.IP \-v 4 |
| 211 |
.IX Item "-v" |
| 212 |
Print the script version and CPAN.pm version then exit. |
| 213 |
.IP \-V 4 |
| 214 |
.IX Item "-V" |
| 215 |
Print detailed information about the cpan client. |
| 216 |
.IP \-w 4 |
| 217 |
.IX Item "-w" |
| 218 |
UNIMPLEMENTED |
| 219 |
.Sp |
| 220 |
Turn on cpan warnings. This checks various things, like directory permissions, |
| 221 |
and tells you about problems you might have. |
| 222 |
.IP "\-x module [ module ... ]" 4 |
| 223 |
.IX Item "-x module [ module ... ]" |
| 224 |
Find close matches to the named modules that you think you might have |
| 225 |
mistyped. This requires the optional installation of Text::Levenshtein or |
| 226 |
Text::Levenshtein::Damerau. |
| 227 |
.IP \-X 4 |
| 228 |
.IX Item "-X" |
| 229 |
Dump all the namespaces to standard output. |
| 230 |
.SS Examples |
| 231 |
.IX Subsection "Examples" |
| 232 |
.Vb 2 |
| 233 |
\& # print a help message |
| 234 |
\& cpan \-h |
| 235 |
\& |
| 236 |
\& # print the version numbers |
| 237 |
\& cpan \-v |
| 238 |
\& |
| 239 |
\& # create an autobundle |
| 240 |
\& cpan \-a |
| 241 |
\& |
| 242 |
\& # recompile modules |
| 243 |
\& cpan \-r |
| 244 |
\& |
| 245 |
\& # upgrade all installed modules |
| 246 |
\& cpan \-u |
| 247 |
\& |
| 248 |
\& # install modules ( sole \-i is optional ) |
| 249 |
\& cpan \-i Netscape::Booksmarks Business::ISBN |
| 250 |
\& |
| 251 |
\& # force install modules ( must use \-i ) |
| 252 |
\& cpan \-fi CGI::Minimal URI |
| 253 |
\& |
| 254 |
\& # install modules but without testing them |
| 255 |
\& cpan \-Ti CGI::Minimal URI |
| 256 |
.Ve |
| 257 |
.SS "Environment variables" |
| 258 |
.IX Subsection "Environment variables" |
| 259 |
There are several components in CPAN.pm that use environment variables. |
| 260 |
The build tools, ExtUtils::MakeMaker and Module::Build use some, |
| 261 |
while others matter to the levels above them. Some of these are specified |
| 262 |
by the Perl Toolchain Gang: |
| 263 |
.PP |
| 264 |
Lancaster Consensus: <https://github.com/Perl\-Toolchain\-Gang/toolchain\-site/blob/master/lancaster\-consensus.md> |
| 265 |
.PP |
| 266 |
Oslo Consensus: <https://github.com/Perl\-Toolchain\-Gang/toolchain\-site/blob/master/oslo\-consensus.md> |
| 267 |
.IP NONINTERACTIVE_TESTING 4 |
| 268 |
.IX Item "NONINTERACTIVE_TESTING" |
| 269 |
Assume no one is paying attention and skips prompts for distributions |
| 270 |
that do that correctly. \f(CWcpan(1)\fR sets this to \f(CW1\fR unless it already |
| 271 |
has a value (even if that value is false). |
| 272 |
.IP PERL_MM_USE_DEFAULT 4 |
| 273 |
.IX Item "PERL_MM_USE_DEFAULT" |
| 274 |
Use the default answer for a prompted questions. \f(CWcpan(1)\fR sets this |
| 275 |
to \f(CW1\fR unless it already has a value (even if that value is false). |
| 276 |
.IP CPAN_OPTS 4 |
| 277 |
.IX Item "CPAN_OPTS" |
| 278 |
As with \f(CW\*(C`PERL5OPT\*(C'\fR, a string of additional \f(CWcpan(1)\fR options to |
| 279 |
add to those you specify on the command line. |
| 280 |
.IP CPANSCRIPT_LOGLEVEL 4 |
| 281 |
.IX Item "CPANSCRIPT_LOGLEVEL" |
| 282 |
The log level to use, with either the embedded, minimal logger or |
| 283 |
Log::Log4perl if it is installed. Possible values are the same as |
| 284 |
the \f(CW\*(C`Log::Log4perl\*(C'\fR levels: \f(CW\*(C`TRACE\*(C'\fR, \f(CW\*(C`DEBUG\*(C'\fR, \f(CW\*(C`INFO\*(C'\fR, \f(CW\*(C`WARN\*(C'\fR, |
| 285 |
\&\f(CW\*(C`ERROR\*(C'\fR, and \f(CW\*(C`FATAL\*(C'\fR. The default is \f(CW\*(C`INFO\*(C'\fR. |
| 286 |
.IP GIT_COMMAND 4 |
| 287 |
.IX Item "GIT_COMMAND" |
| 288 |
The path to the \f(CW\*(C`git\*(C'\fR binary to use for the Git features. The default |
| 289 |
is \f(CW\*(C`/usr/local/bin/git\*(C'\fR. |
| 290 |
.SS Methods |
| 291 |
.IX Subsection "Methods" |
| 292 |
.IP "run( ARGS )" 4 |
| 293 |
.IX Item "run( ARGS )" |
| 294 |
Just do it. |
| 295 |
.Sp |
| 296 |
The \f(CW\*(C`run\*(C'\fR method returns 0 on success and a positive number on |
| 297 |
failure. See the section on EXIT CODES for details on the values. |
| 298 |
.Sp |
| 299 |
CPAN.pm sends all the good stuff either to STDOUT, or to a temp |
| 300 |
file if \f(CW$CPAN::Be_Silent\fR is set. I have to intercept that output |
| 301 |
so I can find out what happened. |
| 302 |
.Sp |
| 303 |
Stolen from File::Path::Expand |
| 304 |
.SH "EXIT VALUES" |
| 305 |
.IX Header "EXIT VALUES" |
| 306 |
The script exits with zero if it thinks that everything worked, or a |
| 307 |
positive number if it thinks that something failed. Note, however, that |
| 308 |
in some cases it has to divine a failure by the output of things it does |
| 309 |
not control. For now, the exit codes are vague: |
| 310 |
.PP |
| 311 |
.Vb 1 |
| 312 |
\& 1 An unknown error |
| 313 |
\& |
| 314 |
\& 2 The was an external problem |
| 315 |
\& |
| 316 |
\& 4 There was an internal problem with the script |
| 317 |
\& |
| 318 |
\& 8 A module failed to install |
| 319 |
.Ve |
| 320 |
.SH "TO DO" |
| 321 |
.IX Header "TO DO" |
| 322 |
* There is initial support for Log4perl if it is available, but I |
| 323 |
haven't gone through everything to make the NullLogger work out |
| 324 |
correctly if Log4perl is not installed. |
| 325 |
.PP |
| 326 |
* When I capture CPAN.pm output, I need to check for errors and |
| 327 |
report them to the user. |
| 328 |
.PP |
| 329 |
* Warnings switch |
| 330 |
.PP |
| 331 |
* Check then exit |
| 332 |
.SH BUGS |
| 333 |
.IX Header "BUGS" |
| 334 |
* none noted |
| 335 |
.SH "SEE ALSO" |
| 336 |
.IX Header "SEE ALSO" |
| 337 |
CPAN, App::cpanminus |
| 338 |
.SH "SOURCE AVAILABILITY" |
| 339 |
.IX Header "SOURCE AVAILABILITY" |
| 340 |
This code is in Github in the CPAN.pm repository: |
| 341 |
.PP |
| 342 |
.Vb 1 |
| 343 |
\& https://github.com/andk/cpanpm |
| 344 |
.Ve |
| 345 |
.PP |
| 346 |
The source used to be tracked separately in another GitHub repo, |
| 347 |
but the canonical source is now in the above repo. |
| 348 |
.SH CREDITS |
| 349 |
.IX Header "CREDITS" |
| 350 |
Japheth Cleaver added the bits to allow a forced install (\f(CW\*(C`\-f\*(C'\fR). |
| 351 |
.PP |
| 352 |
Jim Brandt suggested and provided the initial implementation for the |
| 353 |
up-to-date and Changes features. |
| 354 |
.PP |
| 355 |
Adam Kennedy pointed out that \f(CWexit()\fR causes problems on Windows |
| 356 |
where this script ends up with a .bat extension |
| 357 |
.PP |
| 358 |
David Golden helps integrate this into the \f(CW\*(C`CPAN.pm\*(C'\fR repos. |
| 359 |
.PP |
| 360 |
Jim Keenan fixed up various issues with _download |
| 361 |
.SH AUTHOR |
| 362 |
.IX Header "AUTHOR" |
| 363 |
brian d foy, \f(CW\*(C`<[email protected]>\*(C'\fR |
| 364 |
.SH COPYRIGHT |
| 365 |
.IX Header "COPYRIGHT" |
| 366 |
Copyright (c) 2001\-2021, brian d foy, All Rights Reserved. |
| 367 |
.PP |
| 368 |
You may redistribute this under the same terms as Perl itself. |