Debian Codegraph @

upstream/debian-unstable/man1/cpan.1

raw
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 "CPAN 1"
58 .TH CPAN 1 2026-04-10 "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 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 .IP \-J 4
161 .IX Item "-J"
162 Dump the configuration in the same format that CPAN.pm uses. This is useful
163 for checking the configuration as well as using the dump as a starting point
164 for a new, custom configuration.
165 .IP \-l 4
166 .IX Item "-l"
167 List all installed modules with their versions
168 .IP "\-L author [ author ... ]" 4
169 .IX Item "-L author [ author ... ]"
170 List the modules by the specified authors.
171 .IP \-m 4
172 .IX Item "-m"
173 Make the specified modules.
174 .IP "\-M mirror1,mirror2,..." 4
175 .IX Item "-M mirror1,mirror2,..."
176 A comma-separated list of mirrors to use for just this run. The \f(CW\*(C`\-P\*(C'\fR
177 option can find them for you automatically.
178 .IP \-n 4
179 .IX Item "-n"
180 Do a dry run, but don't actually install anything. (unimplemented)
181 .IP \-O 4
182 .IX Item "-O"
183 Show the out-of-date modules.
184 .IP \-p 4
185 .IX Item "-p"
186 Ping the configured mirrors and print a report
187 .IP \-P 4
188 .IX Item "-P"
189 Find the best mirrors you could be using and use them for the current
190 session.
191 .IP \-r 4
192 .IX Item "-r"
193 Recompiles dynamically loaded modules with CPAN::Shell\->recompile.
194 .IP \-s 4
195 .IX Item "-s"
196 Drop in the CPAN.pm shell. This command does this automatically if you don't
197 specify any arguments.
198 .IP "\-t module [ module ... ]" 4
199 .IX Item "-t module [ module ... ]"
200 Run a `make test` on the specified modules.
201 .IP \-T 4
202 .IX Item "-T"
203 Do not test modules. Simply install them.
204 .IP \-u 4
205 .IX Item "-u"
206 Upgrade all installed modules. Blindly doing this can really break things,
207 so keep a backup.
208 .IP \-v 4
209 .IX Item "-v"
210 Print the script version and CPAN.pm version then exit.
211 .IP \-V 4
212 .IX Item "-V"
213 Print detailed information about the cpan client.
214 .IP \-w 4
215 .IX Item "-w"
216 UNIMPLEMENTED
217 .Sp
218 Turn on cpan warnings. This checks various things, like directory permissions,
219 and tells you about problems you might have.
220 .IP "\-x module [ module ... ]" 4
221 .IX Item "-x module [ module ... ]"
222 Find close matches to the named modules that you think you might have
223 mistyped. This requires the optional installation of Text::Levenshtein or
224 Text::Levenshtein::Damerau.
225 .IP \-X 4
226 .IX Item "-X"
227 Dump all the namespaces to standard output.
228 .SS Examples
229 .IX Subsection "Examples"
230 .Vb 2
231 \& # print a help message
232 \& cpan \-h
233 \&
234 \& # print the version numbers
235 \& cpan \-v
236 \&
237 \& # create an autobundle
238 \& cpan \-a
239 \&
240 \& # recompile modules
241 \& cpan \-r
242 \&
243 \& # upgrade all installed modules
244 \& cpan \-u
245 \&
246 \& # install modules ( sole \-i is optional )
247 \& cpan \-i Netscape::Booksmarks Business::ISBN
248 \&
249 \& # force install modules ( must use \-i )
250 \& cpan \-fi CGI::Minimal URI
251 \&
252 \& # install modules but without testing them
253 \& cpan \-Ti CGI::Minimal URI
254 .Ve
255 .SS "Environment variables"
256 .IX Subsection "Environment variables"
257 There are several components in CPAN.pm that use environment variables.
258 The build tools, ExtUtils::MakeMaker and Module::Build use some,
259 while others matter to the levels above them. Some of these are specified
260 by the Perl Toolchain Gang:
261 .PP
262 Lancaster Consensus: <https://github.com/Perl\-Toolchain\-Gang/toolchain\-site/blob/master/lancaster\-consensus.md>
263 .PP
264 Oslo Consensus: <https://github.com/Perl\-Toolchain\-Gang/toolchain\-site/blob/master/oslo\-consensus.md>
265 .IP NONINTERACTIVE_TESTING 4
266 .IX Item "NONINTERACTIVE_TESTING"
267 Assume no one is paying attention and skips prompts for distributions
268 that do that correctly. \f(CWcpan(1)\fR sets this to \f(CW1\fR unless it already
269 has a value (even if that value is false).
270 .IP PERL_MM_USE_DEFAULT 4
271 .IX Item "PERL_MM_USE_DEFAULT"
272 Use the default answer for a prompted questions. \f(CWcpan(1)\fR sets this
273 to \f(CW1\fR unless it already has a value (even if that value is false).
274 .IP CPAN_OPTS 4
275 .IX Item "CPAN_OPTS"
276 As with \f(CW\*(C`PERL5OPT\*(C'\fR, a string of additional \f(CWcpan(1)\fR options to
277 add to those you specify on the command line.
278 .IP CPANSCRIPT_LOGLEVEL 4
279 .IX Item "CPANSCRIPT_LOGLEVEL"
280 The log level to use, with either the embedded, minimal logger or
281 Log::Log4perl if it is installed. Possible values are the same as
282 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,
283 \&\f(CW\*(C`ERROR\*(C'\fR, and \f(CW\*(C`FATAL\*(C'\fR. The default is \f(CW\*(C`INFO\*(C'\fR.
284 .IP GIT_COMMAND 4
285 .IX Item "GIT_COMMAND"
286 The path to the \f(CW\*(C`git\*(C'\fR binary to use for the Git features. The default
287 is \f(CW\*(C`/usr/local/bin/git\*(C'\fR.
288 .SH "EXIT VALUES"
289 .IX Header "EXIT VALUES"
290 The script exits with zero if it thinks that everything worked, or a
291 positive number if it thinks that something failed. Note, however, that
292 in some cases it has to divine a failure by the output of things it does
293 not control. For now, the exit codes are vague:
294 .PP
295 .Vb 1
296 \& 1 An unknown error
297 \&
298 \& 2 The was an external problem
299 \&
300 \& 4 There was an internal problem with the script
301 \&
302 \& 8 A module failed to install
303 .Ve
304 .SH "TO DO"
305 .IX Header "TO DO"
306 * one shot configuration values from the command line
307 .SH BUGS
308 .IX Header "BUGS"
309 * none noted
310 .SH "SEE ALSO"
311 .IX Header "SEE ALSO"
312 Most behaviour, including environment variables and configuration,
313 comes directly from CPAN.pm.
314 .SH "SOURCE AVAILABILITY"
315 .IX Header "SOURCE AVAILABILITY"
316 This code is in Github in the CPAN.pm repository:
317 .PP
318 .Vb 1
319 \& https://github.com/andk/cpanpm
320 .Ve
321 .PP
322 The source used to be tracked separately in another GitHub repo,
323 but the canonical source is now in the above repo.
324 .SH CREDITS
325 .IX Header "CREDITS"
326 Japheth Cleaver added the bits to allow a forced install (\-f).
327 .PP
328 Jim Brandt suggest and provided the initial implementation for the
329 up-to-date and Changes features.
330 .PP
331 Adam Kennedy pointed out that \fBexit()\fR causes problems on Windows
332 where this script ends up with a .bat extension
333 .SH AUTHOR
334 .IX Header "AUTHOR"
335 brian d foy, \f(CW\*(C`<[email protected]>\*(C'\fR
336 .SH COPYRIGHT
337 .IX Header "COPYRIGHT"
338 Copyright (c) 2001\-2015, brian d foy, All Rights Reserved.
339 .PP
340 You may redistribute this under the same terms as Perl itself.