1CPAN(3pm)              Perl Programmers Reference Guide              CPAN(3pm)
2
3
4

NAME

6       CPAN - query, download and build perl modules from CPAN sites
7

SYNOPSIS

9       Interactive mode:
10
11         perl -MCPAN -e shell
12
13       --or--
14
15         cpan
16
17       Basic commands:
18
19         # Modules:
20
21         cpan> install Acme::Meta                       # in the shell
22
23         CPAN::Shell->install("Acme::Meta");            # in perl
24
25         # Distributions:
26
27         cpan> install NWCLARK/Acme-Meta-0.02.tar.gz    # in the shell
28
29         CPAN::Shell->
30           install("NWCLARK/Acme-Meta-0.02.tar.gz");    # in perl
31
32         # module objects:
33
34         $mo = CPAN::Shell->expandany($mod);
35         $mo = CPAN::Shell->expand("Module",$mod);      # same thing
36
37         # distribution objects:
38
39         $do = CPAN::Shell->expand("Module",$mod)->distribution;
40         $do = CPAN::Shell->expandany($distro);         # same thing
41         $do = CPAN::Shell->expand("Distribution",
42                                   $distro);            # same thing
43

DESCRIPTION

45       The CPAN module automates or at least simplifies the make and install
46       of perl modules and extensions. It includes some primitive searching
47       capabilities and knows how to use Net::FTP, LWP, and certain external
48       download clients to fetch distributions from the net.
49
50       These are fetched from one or more mirrored CPAN (Comprehensive Perl
51       Archive Network) sites and unpacked in a dedicated directory.
52
53       The CPAN module also supports named and versioned bundles of modules.
54       Bundles simplify handling of sets of related modules. See Bundles
55       below.
56
57       The package contains a session manager and a cache manager. The session
58       manager keeps track of what has been fetched, built, and installed in
59       the current session. The cache manager keeps track of the disk space
60       occupied by the make processes and deletes excess space using a simple
61       FIFO mechanism.
62
63       All methods provided are accessible in a programmer style and in an
64       interactive shell style.
65
66   CPAN::shell([$prompt, $command]) Starting Interactive Mode
67       Enter interactive mode by running
68
69           perl -MCPAN -e shell
70
71       or
72
73           cpan
74
75       which puts you into a readline interface. If "Term::ReadKey" and either
76       of "Term::ReadLine::Perl" or "Term::ReadLine::Gnu" are installed,
77       history and command completion are supported.
78
79       Once at the command line, type "h" for one-page help screen; the rest
80       should be self-explanatory.
81
82       The function call "shell" takes two optional arguments: one the prompt,
83       the second the default initial command line (the latter only works if a
84       real ReadLine interface module is installed).
85
86       The most common uses of the interactive modes are
87
88       Searching for authors, bundles, distribution files and modules
89         There are corresponding one-letter commands "a", "b", "d", and "m"
90         for each of the four categories and another, "i" for any of the
91         mentioned four. Each of the four entities is implemented as a class
92         with slightly differing methods for displaying an object.
93
94         Arguments to these commands are either strings exactly matching the
95         identification string of an object, or regular expressions matched
96         case-insensitively against various attributes of the objects. The
97         parser only recognizes a regular expression when you enclose it with
98         slashes.
99
100         The principle is that the number of objects found influences how an
101         item is displayed. If the search finds one item, the result is
102         displayed with the rather verbose method "as_string", but if more
103         than one is found, each object is displayed with the terse method
104         "as_glimpse".
105
106         Examples:
107
108           cpan> m Acme::MetaSyntactic
109           Module id = Acme::MetaSyntactic
110               CPAN_USERID  BOOK (Philippe Bruhat (BooK) <[...]>)
111               CPAN_VERSION 0.99
112               CPAN_FILE    B/BO/BOOK/Acme-MetaSyntactic-0.99.tar.gz
113               UPLOAD_DATE  2006-11-06
114               MANPAGE      Acme::MetaSyntactic - Themed metasyntactic variables names
115               INST_FILE    /usr/local/lib/perl/5.10.0/Acme/MetaSyntactic.pm
116               INST_VERSION 0.99
117           cpan> a BOOK
118           Author id = BOOK
119               EMAIL        [...]
120               FULLNAME     Philippe Bruhat (BooK)
121           cpan> d BOOK/Acme-MetaSyntactic-0.99.tar.gz
122           Distribution id = B/BO/BOOK/Acme-MetaSyntactic-0.99.tar.gz
123               CPAN_USERID  BOOK (Philippe Bruhat (BooK) <[...]>)
124               CONTAINSMODS Acme::MetaSyntactic Acme::MetaSyntactic::Alias [...]
125               UPLOAD_DATE  2006-11-06
126           cpan> m /lorem/
127           Module  = Acme::MetaSyntactic::loremipsum (BOOK/Acme-MetaSyntactic-0.99.tar.gz)
128           Module    Text::Lorem            (ADEOLA/Text-Lorem-0.3.tar.gz)
129           Module    Text::Lorem::More      (RKRIMEN/Text-Lorem-More-0.12.tar.gz)
130           Module    Text::Lorem::More::Source (RKRIMEN/Text-Lorem-More-0.12.tar.gz)
131           cpan> i /berlin/
132           Distribution    BEATNIK/Filter-NumberLines-0.02.tar.gz
133           Module  = DateTime::TimeZone::Europe::Berlin (DROLSKY/DateTime-TimeZone-0.7904.tar.gz)
134           Module    Filter::NumberLines    (BEATNIK/Filter-NumberLines-0.02.tar.gz)
135           Author          [...]
136
137         The examples illustrate several aspects: the first three queries
138         target modules, authors, or distros directly and yield exactly one
139         result. The last two use regular expressions and yield several
140         results. The last one targets all of bundles, modules, authors, and
141         distros simultaneously. When more than one result is available, they
142         are printed in one-line format.
143
144       "get", "make", "test", "install", "clean" modules or distributions
145         These commands take any number of arguments and investigate what is
146         necessary to perform the action. Argument processing is as follows:
147
148           known module name in format Foo/Bar.pm   module
149           other embedded slash                     distribution
150             - with trailing slash dot              directory
151           enclosing slashes                        regexp
152           known module name in format Foo::Bar     module
153
154         If the argument is a distribution file name (recognized by embedded
155         slashes), it is processed. If it is a module, CPAN determines the
156         distribution file in which this module is included and processes
157         that, following any dependencies named in the module's META.yml or
158         Makefile.PL (this behavior is controlled by the configuration
159         parameter "prerequisites_policy"). If an argument is enclosed in
160         slashes it is treated as a regular expression: it is expanded and if
161         the result is a single object (distribution, bundle or module), this
162         object is processed.
163
164         Example:
165
166             install Dummy::Perl                   # installs the module
167             install AUXXX/Dummy-Perl-3.14.tar.gz  # installs that distribution
168             install /Dummy-Perl-3.14/             # same if the regexp is unambiguous
169
170         "get" downloads a distribution file and untars or unzips it, "make"
171         builds it, "test" runs the test suite, and "install" installs it.
172
173         Any "make" or "test" is run unconditionally. An
174
175           install <distribution_file>
176
177         is also run unconditionally. But for
178
179           install <module>
180
181         CPAN checks whether an install is needed and prints module up to date
182         if the distribution file containing the module doesn't need updating.
183
184         CPAN also keeps track of what it has done within the current session
185         and doesn't try to build a package a second time regardless of
186         whether it succeeded or not. It does not repeat a test run if the
187         test has been run successfully before. Same for install runs.
188
189         The "force" pragma may precede another command (currently: "get",
190         "make", "test", or "install") to execute the command from scratch and
191         attempt to continue past certain errors. See the section below on the
192         "force" and the "fforce" pragma.
193
194         The "notest" pragma skips the test part in the build process.
195
196         Example:
197
198             cpan> notest install Tk
199
200         A "clean" command results in a
201
202           make clean
203
204         being executed within the distribution file's working directory.
205
206       "readme", "perldoc", "look" module or distribution
207         "readme" displays the README file of the associated distribution.
208         "Look" gets and untars (if not yet done) the distribution file,
209         changes to the appropriate directory and opens a subshell process in
210         that directory. "perldoc" displays the module's pod documentation in
211         html or plain text format.
212
213       "ls" author
214       "ls" globbing_expression
215         The first form lists all distribution files in and below an author's
216         CPAN directory as stored in the CHECKUMS files distributed on CPAN.
217         The listing recurses into subdirectories.
218
219         The second form limits or expands the output with shell globbing as
220         in the following examples:
221
222               ls JV/make*
223               ls GSAR/*make*
224               ls */*make*
225
226         The last example is very slow and outputs extra progress indicators
227         that break the alignment of the result.
228
229         Note that globbing only lists directories explicitly asked for, for
230         example FOO/* will not list FOO/bar/Acme-Sthg-n.nn.tar.gz. This may
231         be regarded as a bug that may be changed in some future version.
232
233       "failed"
234         The "failed" command reports all distributions that failed on one of
235         "make", "test" or "install" for some reason in the currently running
236         shell session.
237
238       Persistence between sessions
239         If the "YAML" or the "YAML::Syck" module is installed a record of the
240         internal state of all modules is written to disk after each step.
241         The files contain a signature of the currently running perl version
242         for later perusal.
243
244         If the configurations variable "build_dir_reuse" is set to a true
245         value, then CPAN.pm reads the collected YAML files. If the stored
246         signature matches the currently running perl, the stored state is
247         loaded into memory such that persistence between sessions is
248         effectively established.
249
250       The "force" and the "fforce" pragma
251         To speed things up in complex installation scenarios, CPAN.pm keeps
252         track of what it has already done and refuses to do some things a
253         second time. A "get", a "make", and an "install" are not repeated.  A
254         "test" is repeated only if the previous test was unsuccessful. The
255         diagnostic message when CPAN.pm refuses to do something a second time
256         is one of Has already been "unwrapped|made|tested successfully" or
257         something similar. Another situation where CPAN refuses to act is an
258         "install" if the corresponding "test" was not successful.
259
260         In all these cases, the user can override this stubborn behaviour by
261         prepending the command with the word force, for example:
262
263           cpan> force get Foo
264           cpan> force make AUTHOR/Bar-3.14.tar.gz
265           cpan> force test Baz
266           cpan> force install Acme::Meta
267
268         Each forced command is executed with the corresponding part of its
269         memory erased.
270
271         The "fforce" pragma is a variant that emulates a "force get" which
272         erases the entire memory followed by the action specified,
273         effectively restarting the whole get/make/test/install procedure from
274         scratch.
275
276       Lockfile
277         Interactive sessions maintain a lockfile, by default "~/.cpan/.lock".
278         Batch jobs can run without a lockfile and not disturb each other.
279
280         The shell offers to run in downgraded mode when another process is
281         holding the lockfile. This is an experimental feature that is not yet
282         tested very well. This second shell then does not write the history
283         file, does not use the metadata file, and has a different prompt.
284
285       Signals
286         CPAN.pm installs signal handlers for SIGINT and SIGTERM. While you
287         are in the cpan-shell, it is intended that you can press "^C" anytime
288         and return to the cpan-shell prompt. A SIGTERM will cause the cpan-
289         shell to clean up and leave the shell loop. You can emulate the
290         effect of a SIGTERM by sending two consecutive SIGINTs, which usually
291         means by pressing "^C" twice.
292
293         CPAN.pm ignores SIGPIPE. If the user sets "inactivity_timeout", a
294         SIGALRM is used during the run of the "perl Makefile.PL" or "perl
295         Build.PL" subprocess. A SIGALRM is also used during module version
296         parsing, and is controlled by "version_timeout".
297
298   CPAN::Shell
299       The commands available in the shell interface are methods in the
300       package CPAN::Shell. If you enter the shell command, your input is
301       split by the Text::ParseWords::shellwords() routine, which acts like
302       most shells do. The first word is interpreted as the method to be
303       invoked, and the rest of the words are treated as the method's
304       arguments.  Continuation lines are supported by ending a line with a
305       literal backslash.
306
307   autobundle
308       "autobundle" writes a bundle file into the
309       "$CPAN::Config->{cpan_home}/Bundle" directory. The file contains a list
310       of all modules that are both available from CPAN and currently
311       installed within @INC. The name of the bundle file is based on the
312       current date and a counter.
313
314   hosts
315       Note: this feature is still in alpha state and may change in future
316       versions of CPAN.pm
317
318       This commands provides a statistical overview over recent download
319       activities. The data for this is collected in the YAML file
320       "FTPstats.yml" in your "cpan_home" directory. If no YAML module is
321       configured or YAML not installed, no stats are provided.
322
323   mkmyconfig
324       mkmyconfig() writes your own CPAN::MyConfig file into your "~/.cpan/"
325       directory so that you can save your own preferences instead of the
326       system-wide ones.
327
328   recent ***EXPERIMENTAL COMMAND***
329       The "recent" command downloads a list of recent uploads to CPAN and
330       displays them slowly. While the command is running, a $SIG{INT} exits
331       the loop after displaying the current item.
332
333       Note: This command requires XML::LibXML installed.
334
335       Note: This whole command currently is just a hack and will probably
336       change in future versions of CPAN.pm, but the general approach will
337       likely remain.
338
339       Note: See also smoke
340
341   recompile
342       recompile() is a special command that takes no argument and runs the
343       make/test/install cycle with brute force over all installed dynamically
344       loadable extensions (aka XS modules) with 'force' in effect. The
345       primary purpose of this command is to finish a network installation.
346       Imagine you have a common source tree for two different architectures.
347       You decide to do a completely independent fresh installation. You start
348       on one architecture with the help of a Bundle file produced earlier.
349       CPAN installs the whole Bundle for you, but when you try to repeat the
350       job on the second architecture, CPAN responds with a "Foo up to date"
351       message for all modules. So you invoke CPAN's recompile on the second
352       architecture and you're done.
353
354       Another popular use for "recompile" is to act as a rescue in case your
355       perl breaks binary compatibility. If one of the modules that CPAN uses
356       is in turn depending on binary compatibility (so you cannot run CPAN
357       commands), then you should try the CPAN::Nox module for recovery.
358
359   report Bundle|Distribution|Module
360       The "report" command temporarily turns on the "test_report" config
361       variable, then runs the "force test" command with the given arguments.
362       The "force" pragma reruns the tests and repeats every step that might
363       have failed before.
364
365   smoke ***EXPERIMENTAL COMMAND***
366       *** WARNING: this command downloads and executes software from CPAN to
367       your computer of completely unknown status. You should never do this
368       with your normal account and better have a dedicated well separated and
369       secured machine to do this. ***
370
371       The "smoke" command takes the list of recent uploads to CPAN as
372       provided by the "recent" command and tests them all. While the command
373       is running $SIG{INT} is defined to mean that the current item shall be
374       skipped.
375
376       Note: This whole command currently is just a hack and will probably
377       change in future versions of CPAN.pm, but the general approach will
378       likely remain.
379
380       Note: See also recent
381
382   upgrade [Module|/Regex/]...
383       The "upgrade" command first runs an "r" command with the given
384       arguments and then installs the newest versions of all modules that
385       were listed by that.
386
387   The four "CPAN::*" Classes: Author, Bundle, Module, Distribution
388       Although it may be considered internal, the class hierarchy does matter
389       for both users and programmer. CPAN.pm deals with the four classes
390       mentioned above, and those classes all share a set of methods.
391       Classical single polymorphism is in effect. A metaclass object
392       registers all objects of all kinds and indexes them with a string. The
393       strings referencing objects have a separated namespace (well, not
394       completely separated):
395
396                Namespace                         Class
397
398          words containing a "/" (slash)      Distribution
399           words starting with Bundle::          Bundle
400                 everything else            Module or Author
401
402       Modules know their associated Distribution objects. They always refer
403       to the most recent official release. Developers may mark their releases
404       as unstable development versions (by inserting an underbar into the
405       module version number which will also be reflected in the distribution
406       name when you run 'make dist'), so the really hottest and newest
407       distribution is not always the default.  If a module Foo circulates on
408       CPAN in both version 1.23 and 1.23_90, CPAN.pm offers a convenient way
409       to install version 1.23 by saying
410
411           install Foo
412
413       This would install the complete distribution file (say
414       BAR/Foo-1.23.tar.gz) with all accompanying material. But if you would
415       like to install version 1.23_90, you need to know where the
416       distribution file resides on CPAN relative to the authors/id/
417       directory. If the author is BAR, this might be BAR/Foo-1.23_90.tar.gz;
418       so you would have to say
419
420           install BAR/Foo-1.23_90.tar.gz
421
422       The first example will be driven by an object of the class
423       CPAN::Module, the second by an object of class CPAN::Distribution.
424
425   Integrating local directories
426       Note: this feature is still in alpha state and may change in future
427       versions of CPAN.pm
428
429       Distribution objects are normally distributions from the CPAN, but
430       there is a slightly degenerate case for Distribution objects, too, of
431       projects held on the local disk. These distribution objects have the
432       same name as the local directory and end with a dot. A dot by itself is
433       also allowed for the current directory at the time CPAN.pm was used.
434       All actions such as "make", "test", and "install" are applied directly
435       to that directory. This gives the command "cpan ." an interesting
436       touch: while the normal mantra of installing a CPAN module without
437       CPAN.pm is one of
438
439           perl Makefile.PL                 perl Build.PL
440                  ( go and get prerequisites )
441           make                             ./Build
442           make test                        ./Build test
443           make install                     ./Build install
444
445       the command "cpan ." does all of this at once. It figures out which of
446       the two mantras is appropriate, fetches and installs all prerequisites,
447       takes care of them recursively, and finally finishes the installation
448       of the module in the current directory, be it a CPAN module or not.
449
450       The typical usage case is for private modules or working copies of
451       projects from remote repositories on the local disk.
452
453   Redirection
454       The usual shell redirection symbols " | " and ">" are recognized by the
455       cpan shell only when surrounded by whitespace. So piping to pager or
456       redirecting output into a file works somewhat as in a normal shell,
457       with the stipulation that you must type extra spaces.
458

CONFIGURATION

460       When the CPAN module is used for the first time, a configuration
461       dialogue tries to determine a couple of site specific options. The
462       result of the dialog is stored in a hash reference  $CPAN::Config in a
463       file CPAN/Config.pm.
464
465       Default values defined in the CPAN/Config.pm file can be overridden in
466       a user specific file: CPAN/MyConfig.pm. Such a file is best placed in
467       "$HOME/.cpan/CPAN/MyConfig.pm", because "$HOME/.cpan" is added to the
468       search path of the CPAN module before the use() or require()
469       statements. The mkmyconfig command writes this file for you.
470
471       The "o conf" command has various bells and whistles:
472
473       completion support
474           If you have a ReadLine module installed, you can hit TAB at any
475           point of the commandline and "o conf" will offer you completion for
476           the built-in subcommands and/or config variable names.
477
478       displaying some help: o conf help
479           Displays a short help
480
481       displaying current values: o conf [KEY]
482           Displays the current value(s) for this config variable. Without
483           KEY, displays all subcommands and config variables.
484
485           Example:
486
487             o conf shell
488
489           If KEY starts and ends with a slash, the string in between is
490           treated as a regular expression and only keys matching this regex
491           are displayed
492
493           Example:
494
495             o conf /color/
496
497       changing of scalar values: o conf KEY VALUE
498           Sets the config variable KEY to VALUE. The empty string can be
499           specified as usual in shells, with '' or ""
500
501           Example:
502
503             o conf wget /usr/bin/wget
504
505       changing of list values: o conf KEY SHIFT|UNSHIFT|PUSH|POP|SPLICE|LIST
506           If a config variable name ends with "list", it is a list. "o conf
507           KEY shift" removes the first element of the list, "o conf KEY pop"
508           removes the last element of the list. "o conf KEYS unshift LIST"
509           prepends a list of values to the list, "o conf KEYS push LIST"
510           appends a list of valued to the list.
511
512           Likewise, "o conf KEY splice LIST" passes the LIST to the
513           corresponding splice command.
514
515           Finally, any other list of arguments is taken as a new list value
516           for the KEY variable discarding the previous value.
517
518           Examples:
519
520             o conf urllist unshift http://cpan.dev.local/CPAN
521             o conf urllist splice 3 1
522             o conf urllist http://cpan1.local http://cpan2.local ftp://ftp.perl.org
523
524       reverting to saved: o conf defaults
525           Reverts all config variables to the state in the saved config file.
526
527       saving the config: o conf commit
528           Saves all config variables to the current config file
529           (CPAN/Config.pm or CPAN/MyConfig.pm that was loaded at start).
530
531       The configuration dialog can be started any time later again by issuing
532       the command " o conf init " in the CPAN shell. A subset of the
533       configuration dialog can be run by issuing "o conf init WORD" where
534       WORD is any valid config variable or a regular expression.
535
536   Config Variables
537       The following keys in the hash reference $CPAN::Config are currently
538       defined:
539
540         applypatch         path to external prg
541         auto_commit        commit all changes to config variables to disk
542         build_cache        size of cache for directories to build modules
543         build_dir          locally accessible directory to build modules
544         build_dir_reuse    boolean if distros in build_dir are persistent
545         build_requires_install_policy
546                            to install or not to install when a module is
547                            only needed for building. yes|no|ask/yes|ask/no
548         bzip2              path to external prg
549         cache_metadata     use serializer to cache metadata
550         check_sigs         if signatures should be verified
551         colorize_debug     Term::ANSIColor attributes for debugging output
552         colorize_output    boolean if Term::ANSIColor should colorize output
553         colorize_print     Term::ANSIColor attributes for normal output
554         colorize_warn      Term::ANSIColor attributes for warnings
555         commandnumber_in_prompt
556                            boolean if you want to see current command number
557         commands_quote     preferred character to use for quoting external
558                            commands when running them. Defaults to double
559                            quote on Windows, single tick everywhere else;
560                            can be set to space to disable quoting
561         connect_to_internet_ok
562                            whether to ask if opening a connection is ok before
563                            urllist is specified
564         cpan_home          local directory reserved for this package
565         curl               path to external prg
566         dontload_hash      DEPRECATED
567         dontload_list      arrayref: modules in the list will not be
568                            loaded by the CPAN::has_inst() routine
569         ftp                path to external prg
570         ftp_passive        if set, the envariable FTP_PASSIVE is set for downloads
571         ftp_proxy          proxy host for ftp requests
572         ftpstats_period    max number of days to keep download statistics
573         ftpstats_size      max number of items to keep in the download statistics
574         getcwd             see below
575         gpg                path to external prg
576         gzip               location of external program gzip
577         halt_on_failure    stop processing after the first failure of queued
578                            items or dependencies
579         histfile           file to maintain history between sessions
580         histsize           maximum number of lines to keep in histfile
581         http_proxy         proxy host for http requests
582         inactivity_timeout breaks interactive Makefile.PLs or Build.PLs
583                            after this many seconds inactivity. Set to 0 to
584                            disable timeouts.
585         index_expire       refetch index files after this many days
586         inhibit_startup_message
587                            if true, suppress the startup message
588         keep_source_where  directory in which to keep the source (if we do)
589         load_module_verbosity
590                            report loading of optional modules used by CPAN.pm
591         lynx               path to external prg
592         make               location of external make program
593         make_arg           arguments that should always be passed to 'make'
594         make_install_make_command
595                            the make command for running 'make install', for
596                            example 'sudo make'
597         make_install_arg   same as make_arg for 'make install'
598         makepl_arg         arguments passed to 'perl Makefile.PL'
599         mbuild_arg         arguments passed to './Build'
600         mbuild_install_arg arguments passed to './Build install'
601         mbuild_install_build_command
602                            command to use instead of './Build' when we are
603                            in the install stage, for example 'sudo ./Build'
604         mbuildpl_arg       arguments passed to 'perl Build.PL'
605         ncftp              path to external prg
606         ncftpget           path to external prg
607         no_proxy           don't proxy to these hosts/domains (comma separated list)
608         pager              location of external program more (or any pager)
609         password           your password if you CPAN server wants one
610         patch              path to external prg
611         patches_dir        local directory containing patch files
612         perl5lib_verbosity verbosity level for PERL5LIB additions
613         prefer_installer   legal values are MB and EUMM: if a module comes
614                            with both a Makefile.PL and a Build.PL, use the
615                            former (EUMM) or the latter (MB); if the module
616                            comes with only one of the two, that one will be
617                            used no matter the setting
618         prerequisites_policy
619                            what to do if you are missing module prerequisites
620                            ('follow' automatically, 'ask' me, or 'ignore')
621                            For 'follow', also sets PERL_AUTOINSTALL and
622                            PERL_EXTUTILS_AUTOINSTALL for "--defaultdeps" if
623                            not already set
624         prefs_dir          local directory to store per-distro build options
625         proxy_user         username for accessing an authenticating proxy
626         proxy_pass         password for accessing an authenticating proxy
627         randomize_urllist  add some randomness to the sequence of the urllist
628         scan_cache         controls scanning of cache ('atstart' or 'never')
629         shell              your favorite shell
630         show_unparsable_versions
631                            boolean if r command tells which modules are versionless
632         show_upload_date   boolean if commands should try to determine upload date
633         show_zero_versions boolean if r command tells for which modules $version==0
634         tar                location of external program tar
635         tar_verbosity      verbosity level for the tar command
636         term_is_latin      deprecated: if true Unicode is translated to ISO-8859-1
637                            (and nonsense for characters outside latin range)
638         term_ornaments     boolean to turn ReadLine ornamenting on/off
639         test_report        email test reports (if CPAN::Reporter is installed)
640         trust_test_report_history
641                            skip testing when previously tested ok (according to
642                            CPAN::Reporter history)
643         unzip              location of external program unzip
644         urllist            arrayref to nearby CPAN sites (or equivalent locations)
645         use_sqlite         use CPAN::SQLite for metadata storage (fast and lean)
646         username           your username if you CPAN server wants one
647         version_timeout    stops version parsing after this many seconds.
648                            Default is 15 secs. Set to 0 to disable.
649         wait_list          arrayref to a wait server to try (See CPAN::WAIT)
650         wget               path to external prg
651         yaml_load_code     enable YAML code deserialisation via CPAN::DeferredCode
652         yaml_module        which module to use to read/write YAML files
653
654       You can set and query each of these options interactively in the cpan
655       shell with the "o conf" or the "o conf init" command as specified
656       below.
657
658       "o conf <scalar option>"
659         prints the current value of the scalar option
660
661       "o conf <scalar option> <value>"
662         Sets the value of the scalar option to value
663
664       "o conf <list option>"
665         prints the current value of the list option in MakeMaker's neatvalue
666         format.
667
668       "o conf <list option> [shift|pop]"
669         shifts or pops the array in the list option variable
670
671       "o conf <list option> [unshift|push|splice] <list>"
672         works like the corresponding perl commands.
673
674       interactive editing: o conf init [MATCH|LIST]
675         Runs an interactive configuration dialog for matching variables.
676         Without argument runs the dialog over all supported config variables.
677         To specify a MATCH the argument must be enclosed by slashes.
678
679         Examples:
680
681           o conf init ftp_passive ftp_proxy
682           o conf init /color/
683
684         Note: this method of setting config variables often provides more
685         explanation about the functioning of a variable than the manpage.
686
687   CPAN::anycwd($path): Note on config variable getcwd
688       CPAN.pm changes the current working directory often and needs to
689       determine its own current working directory. By default it uses
690       Cwd::cwd, but if for some reason this doesn't work on your system,
691       configure alternatives according to the following table:
692
693       cwd Calls Cwd::cwd
694
695       getcwd
696           Calls Cwd::getcwd
697
698       fastcwd
699           Calls Cwd::fastcwd
700
701       backtickcwd
702           Calls the external command cwd.
703
704   Note on the format of the urllist parameter
705       urllist parameters are URLs according to RFC 1738. We do a little
706       guessing if your URL is not compliant, but if you have problems with
707       "file" URLs, please try the correct format. Either:
708
709           file://localhost/whatever/ftp/pub/CPAN/
710
711       or
712
713           file:///home/ftp/pub/CPAN/
714
715   The urllist parameter has CD-ROM support
716       The "urllist" parameter of the configuration table contains a list of
717       URLs used for downloading. If the list contains any "file" URLs, CPAN
718       always tries there first. This feature is disabled for index files. So
719       the recommendation for the owner of a CD-ROM with CPAN contents is:
720       include your local, possibly outdated CD-ROM as a "file" URL at the end
721       of urllist, e.g.
722
723         o conf urllist push file://localhost/CDROM/CPAN
724
725       CPAN.pm will then fetch the index files from one of the CPAN sites that
726       come at the beginning of urllist. It will later check for each module
727       to see whether there is a local copy of the most recent version.
728
729       Another peculiarity of urllist is that the site that we could
730       successfully fetch the last file from automatically gets a preference
731       token and is tried as the first site for the next request. So if you
732       add a new site at runtime it may happen that the previously preferred
733       site will be tried another time. This means that if you want to
734       disallow a site for the next transfer, it must be explicitly removed
735       from urllist.
736
737   Maintaining the urllist parameter
738       If you have YAML.pm (or some other YAML module configured in
739       "yaml_module") installed, CPAN.pm collects a few statistical data about
740       recent downloads. You can view the statistics with the "hosts" command
741       or inspect them directly by looking into the "FTPstats.yml" file in
742       your "cpan_home" directory.
743
744       To get some interesting statistics, it is recommended that
745       "randomize_urllist" be set; this introduces some amount of randomness
746       into the URL selection.
747
748   The "requires" and "build_requires" dependency declarations
749       Since CPAN.pm version 1.88_51 modules declared as "build_requires" by a
750       distribution are treated differently depending on the config variable
751       "build_requires_install_policy". By setting
752       "build_requires_install_policy" to "no", such a module is not
753       installed. It is only built and tested, and then kept in the list of
754       tested but uninstalled modules. As such, it is available during the
755       build of the dependent module by integrating the path to the
756       "blib/arch" and "blib/lib" directories in the environment variable
757       PERL5LIB. If "build_requires_install_policy" is set ti "yes", then both
758       modules declared as "requires" and those declared as "build_requires"
759       are treated alike. By setting to "ask/yes" or "ask/no", CPAN.pm asks
760       the user and sets the default accordingly.
761
762   Configuration for individual distributions (Distroprefs)
763       (Note: This feature has been introduced in CPAN.pm 1.8854 and is still
764       considered beta quality)
765
766       Distributions on CPAN usually behave according to what we call the CPAN
767       mantra. Or since the advent of Module::Build we should talk about two
768       mantras:
769
770           perl Makefile.PL     perl Build.PL
771           make                 ./Build
772           make test            ./Build test
773           make install         ./Build install
774
775       But some modules cannot be built with this mantra. They try to get some
776       extra data from the user via the environment, extra arguments, or
777       interactively--thus disturbing the installation of large bundles like
778       Phalanx100 or modules with many dependencies like Plagger.
779
780       The distroprefs system of "CPAN.pm" addresses this problem by allowing
781       the user to specify extra informations and recipes in YAML files to
782       either
783
784       ·   pass additional arguments to one of the four commands,
785
786       ·   set environment variables
787
788       ·   instantiate an Expect object that reads from the console, waits for
789           some regular expressions and enters some answers
790
791       ·   temporarily override assorted "CPAN.pm" configuration variables
792
793       ·   specify dependencies the original maintainer forgot
794
795       ·   disable the installation of an object altogether
796
797       See the YAML and Data::Dumper files that come with the "CPAN.pm"
798       distribution in the "distroprefs/" directory for examples.
799
800   Filenames
801       The YAML files themselves must have the ".yml" extension; all other
802       files are ignored (for two exceptions see Fallback Data::Dumper and
803       Storable below). The containing directory can be specified in "CPAN.pm"
804       in the "prefs_dir" config variable. Try "o conf init prefs_dir" in the
805       CPAN shell to set and activate the distroprefs system.
806
807       Every YAML file may contain arbitrary documents according to the YAML
808       specification, and every document is treated as an entity that can
809       specify the treatment of a single distribution.
810
811       Filenames can be picked arbitrarily; "CPAN.pm" always reads all files
812       (in alphabetical order) and takes the key "match" (see below in
813       Language Specs) as a hashref containing match criteria that determine
814       if the current distribution matches the YAML document or not.
815
816   Fallback Data::Dumper and Storable
817       If neither your configured "yaml_module" nor YAML.pm is installed,
818       CPAN.pm falls back to using Data::Dumper and Storable and looks for
819       files with the extensions ".dd" or ".st" in the "prefs_dir" directory.
820       These files are expected to contain one or more hashrefs.  For
821       Data::Dumper generated files, this is expected to be done with by
822       defining $VAR1, $VAR2, etc. The YAML shell would produce these with the
823       command
824
825           ysh < somefile.yml > somefile.dd
826
827       For Storable files the rule is that they must be constructed such that
828       "Storable::retrieve(file)" returns an array reference and the array
829       elements represent one distropref object each. The conversion from YAML
830       would look like so:
831
832           perl -MYAML=LoadFile -MStorable=nstore -e '
833               @y=LoadFile(shift);
834               nstore(\@y, shift)' somefile.yml somefile.st
835
836       In bootstrapping situations it is usually sufficient to translate only
837       a few YAML files to Data::Dumper for crucial modules like "YAML::Syck",
838       "YAML.pm" and "Expect.pm". If you prefer Storable over Data::Dumper,
839       remember to pull out a Storable version that writes an older format
840       than all the other Storable versions that will need to read them.
841
842   Blueprint
843       The following example contains all supported keywords and structures
844       with the exception of "eexpect" which can be used instead of "expect".
845
846         ---
847         comment: "Demo"
848         match:
849           module: "Dancing::Queen"
850           distribution: "^CHACHACHA/Dancing-"
851           not_distribution: "\.zip$"
852           perl: "/usr/local/cariba-perl/bin/perl"
853           perlconfig:
854             archname: "freebsd"
855             not_cc: "gcc"
856           env:
857             DANCING_FLOOR: "Shubiduh"
858         disabled: 1
859         cpanconfig:
860           make: gmake
861         pl:
862           args:
863             - "--somearg=specialcase"
864
865           env: {}
866
867           expect:
868             - "Which is your favorite fruit"
869             - "apple\n"
870
871         make:
872           args:
873             - all
874             - extra-all
875
876           env: {}
877
878           expect: []
879
880           commandline: "echo SKIPPING make"
881
882         test:
883           args: []
884
885           env: {}
886
887           expect: []
888
889         install:
890           args: []
891
892           env:
893             WANT_TO_INSTALL: YES
894
895           expect:
896             - "Do you really want to install"
897             - "y\n"
898
899         patches:
900           - "ABCDE/Fedcba-3.14-ABCDE-01.patch"
901
902         depends:
903           configure_requires:
904             LWP: 5.8
905           build_requires:
906             Test::Exception: 0.25
907           requires:
908             Spiffy: 0.30
909
910   Language Specs
911       Every YAML document represents a single hash reference. The valid keys
912       in this hash are as follows:
913
914       comment [scalar]
915           A comment
916
917       cpanconfig [hash]
918           Temporarily override assorted "CPAN.pm" configuration variables.
919
920           Supported are: "build_requires_install_policy", "check_sigs",
921           "make", "make_install_make_command", "prefer_installer",
922           "test_report". Please report as a bug when you need another one
923           supported.
924
925       depends [hash] *** EXPERIMENTAL FEATURE ***
926           All three types, namely "configure_requires", "build_requires", and
927           "requires" are supported in the way specified in the META.yml
928           specification. The current implementation merges the specified
929           dependencies with those declared by the package maintainer. In a
930           future implementation this may be changed to override the original
931           declaration.
932
933       disabled [boolean]
934           Specifies that this distribution shall not be processed at all.
935
936       features [array] *** EXPERIMENTAL FEATURE ***
937           Experimental implementation to deal with optional_features from
938           META.yml. Still needs coordination with installer software and
939           currently works only for META.yml declaring "dynamic_config=0". Use
940           with caution.
941
942       goto [string]
943           The canonical name of a delegate distribution to install instead.
944           Useful when a new version, although it tests OK itself, breaks
945           something else or a developer release or a fork is already uploaded
946           that is better than the last released version.
947
948       install [hash]
949           Processing instructions for the "make install" or "./Build install"
950           phase of the CPAN mantra. See below under Processing Instructions.
951
952       make [hash]
953           Processing instructions for the "make" or "./Build" phase of the
954           CPAN mantra. See below under Processing Instructions.
955
956       match [hash]
957           A hashref with one or more of the keys "distribution", "modules",
958           "perl", "perlconfig", and "env" that specify whether a document is
959           targeted at a specific CPAN distribution or installation.  Keys
960           prefixed with "not_" negates the corresponding match.
961
962           The corresponding values are interpreted as regular expressions.
963           The "distribution" related one will be matched against the
964           canonical distribution name, e.g. "AUTHOR/Foo-Bar-3.14.tar.gz".
965
966           The "module" related one will be matched against all modules
967           contained in the distribution until one module matches.
968
969           The "perl" related one will be matched against $^X (but with the
970           absolute path).
971
972           The value associated with "perlconfig" is itself a hashref that is
973           matched against corresponding values in the %Config::Config hash
974           living in the "Config.pm" module.  Keys prefixed with "not_"
975           negates the corresponding match.
976
977           The value associated with "env" is itself a hashref that is matched
978           against corresponding values in the %ENV hash.  Keys prefixed with
979           "not_" negates the corresponding match.
980
981           If more than one restriction of "module", "distribution", etc. is
982           specified, the results of the separately computed match values must
983           all match. If so, the hashref represented by the YAML document is
984           returned as the preference structure for the current distribution.
985
986       patches [array]
987           An array of patches on CPAN or on the local disk to be applied in
988           order via an external patch program. If the value for the "-p"
989           parameter is 0 or 1 is determined by reading the patch beforehand.
990           The path to each patch is either an absolute path on the local
991           filesystem or relative to a patch directory specified in the
992           "patches_dir" configuration variable or in the format of a
993           canonical distroname. For examples please consult the distroprefs/
994           directory in the CPAN.pm distribution (these examples are not
995           installed by default).
996
997           Note: if the "applypatch" program is installed and "CPAN::Config"
998           knows about it and a patch is written by the "makepatch" program,
999           then "CPAN.pm" lets "applypatch" apply the patch. Both "makepatch"
1000           and "applypatch" are available from CPAN in the "JV/makepatch-*"
1001           distribution.
1002
1003       pl [hash]
1004           Processing instructions for the "perl Makefile.PL" or "perl
1005           Build.PL" phase of the CPAN mantra. See below under Processing
1006           Instructions.
1007
1008       test [hash]
1009           Processing instructions for the "make test" or "./Build test" phase
1010           of the CPAN mantra. See below under Processing Instructions.
1011
1012   Processing Instructions
1013       args [array]
1014           Arguments to be added to the command line
1015
1016       commandline
1017           A full commandline to run via "system()".  During execution, the
1018           environment variable PERL is set to $^X (but with an absolute
1019           path). If "commandline" is specified, "args" is not used.
1020
1021       eexpect [hash]
1022           Extended "expect". This is a hash reference with four allowed keys,
1023           "mode", "timeout", "reuse", and "talk".
1024
1025           You must install the "Expect" module to use "eexpect". CPAN.pm does
1026           not install it for you.
1027
1028           "mode" may have the values "deterministic" for the case where all
1029           questions come in the order written down and "anyorder" for the
1030           case where the questions may come in any order. The default mode is
1031           "deterministic".
1032
1033           "timeout" denotes a timeout in seconds. Floating-point timeouts are
1034           OK. With "mode=deterministic", the timeout denotes the timeout per
1035           question; with "mode=anyorder" it denotes the timeout per byte
1036           received from the stream or questions.
1037
1038           "talk" is a reference to an array that contains alternating
1039           questions and answers. Questions are regular expressions and
1040           answers are literal strings. The Expect module watches the stream
1041           from the execution of the external program ("perl Makefile.PL",
1042           "perl Build.PL", "make", etc.).
1043
1044           For "mode=deterministic", the CPAN.pm injects the corresponding
1045           answer as soon as the stream matches the regular expression.
1046
1047           For "mode=anyorder" CPAN.pm answers a question as soon as the
1048           timeout is reached for the next byte in the input stream. In this
1049           mode you can use the "reuse" parameter to decide what will happen
1050           with a question-answer pair after it has been used. In the default
1051           case (reuse=0) it is removed from the array, avoiding being used
1052           again accidentally. If you want to answer the question "Do you
1053           really want to do that" several times, then it must be included in
1054           the array at least as often as you want this answer to be given.
1055           Setting the parameter "reuse" to 1 makes this repetition
1056           unnecessary.
1057
1058       env [hash]
1059           Environment variables to be set during the command
1060
1061       expect [array]
1062           You must install the "Expect" module to use "expect". CPAN.pm does
1063           not install it for you.
1064
1065           "expect: <array>" is a short notation for this "eexpect":
1066
1067                   eexpect:
1068                           mode: deterministic
1069                           timeout: 15
1070                           talk: <array>
1071
1072   Schema verification with "Kwalify"
1073       If you have the "Kwalify" module installed (which is part of the
1074       Bundle::CPANxxl), then all your distroprefs files are checked for
1075       syntactic correctness.
1076
1077   Example Distroprefs Files
1078       "CPAN.pm" comes with a collection of example YAML files. Note that
1079       these are really just examples and should not be used without care
1080       because they cannot fit everybody's purpose. After all, the authors of
1081       the packages that ask questions had a need to ask, so you should watch
1082       their questions and adjust the examples to your environment and your
1083       needs. You have been warned:-)
1084

PROGRAMMER'S INTERFACE

1086       If you do not enter the shell, shell commands are available both as
1087       methods ("CPAN::Shell->install(...)") and as functions in the calling
1088       package ("install(...)").  Before calling low-level commands, it makes
1089       sense to initialize components of CPAN you need, e.g.:
1090
1091         CPAN::HandleConfig->load;
1092         CPAN::Shell::setup_output;
1093         CPAN::Index->reload;
1094
1095       High-level commands do such initializations automatically.
1096
1097       There's currently only one class that has a stable interface -
1098       CPAN::Shell. All commands that are available in the CPAN shell are
1099       methods of the class CPAN::Shell. Each of the commands that produce
1100       listings of modules ("r", "autobundle", "u") also return a list of the
1101       IDs of all modules within the list.
1102
1103       expand($type,@things)
1104         The IDs of all objects available within a program are strings that
1105         can be expanded to the corresponding real objects with the
1106         "CPAN::Shell->expand("Module",@things)" method. Expand returns a list
1107         of CPAN::Module objects according to the @things arguments given. In
1108         scalar context, it returns only the first element of the list.
1109
1110       expandany(@things)
1111         Like expand, but returns objects of the appropriate type, i.e.
1112         CPAN::Bundle objects for bundles, CPAN::Module objects for modules,
1113         and CPAN::Distribution objects for distributions. Note: it does not
1114         expand to CPAN::Author objects.
1115
1116       Programming Examples
1117         This enables the programmer to do operations that combine
1118         functionalities that are available in the shell.
1119
1120             # install everything that is outdated on my disk:
1121             perl -MCPAN -e 'CPAN::Shell->install(CPAN::Shell->r)'
1122
1123             # install my favorite programs if necessary:
1124             for $mod (qw(Net::FTP Digest::SHA Data::Dumper)) {
1125                 CPAN::Shell->install($mod);
1126             }
1127
1128             # list all modules on my disk that have no VERSION number
1129             for $mod (CPAN::Shell->expand("Module","/./")) {
1130                 next unless $mod->inst_file;
1131                 # MakeMaker convention for undefined $VERSION:
1132                 next unless $mod->inst_version eq "undef";
1133                 print "No VERSION in ", $mod->id, "\n";
1134             }
1135
1136             # find out which distribution on CPAN contains a module:
1137             print CPAN::Shell->expand("Module","Apache::Constants")->cpan_file
1138
1139         Or if you want to schedule a cron job to watch CPAN, you could list
1140         all modules that need updating. First a quick and dirty way:
1141
1142             perl -e 'use CPAN; CPAN::Shell->r;'
1143
1144         If you don't want any output should all modules be up to date, parse
1145         the output of above command for the regular expression "/modules are
1146         up to date/" and decide to mail the output only if it doesn't match.
1147
1148         If you prefer to do it more in a programmerish style in one single
1149         process, something like this may better suit you:
1150
1151           # list all modules on my disk that have newer versions on CPAN
1152           for $mod (CPAN::Shell->expand("Module","/./")) {
1153             next unless $mod->inst_file;
1154             next if $mod->uptodate;
1155             printf "Module %s is installed as %s, could be updated to %s from CPAN\n",
1156                 $mod->id, $mod->inst_version, $mod->cpan_version;
1157           }
1158
1159         If that gives too much output every day, you may want to watch only
1160         for three modules. You can write
1161
1162           for $mod (CPAN::Shell->expand("Module","/Apache|LWP|CGI/")) {
1163
1164         as the first line instead. Or you can combine some of the above
1165         tricks:
1166
1167           # watch only for a new mod_perl module
1168           $mod = CPAN::Shell->expand("Module","mod_perl");
1169           exit if $mod->uptodate;
1170           # new mod_perl arrived, let me know all update recommendations
1171           CPAN::Shell->r;
1172
1173   Methods in the other Classes
1174       CPAN::Author::as_glimpse()
1175           Returns a one-line description of the author
1176
1177       CPAN::Author::as_string()
1178           Returns a multi-line description of the author
1179
1180       CPAN::Author::email()
1181           Returns the author's email address
1182
1183       CPAN::Author::fullname()
1184           Returns the author's name
1185
1186       CPAN::Author::name()
1187           An alias for fullname
1188
1189       CPAN::Bundle::as_glimpse()
1190           Returns a one-line description of the bundle
1191
1192       CPAN::Bundle::as_string()
1193           Returns a multi-line description of the bundle
1194
1195       CPAN::Bundle::clean()
1196           Recursively runs the "clean" method on all items contained in the
1197           bundle.
1198
1199       CPAN::Bundle::contains()
1200           Returns a list of objects' IDs contained in a bundle. The
1201           associated objects may be bundles, modules or distributions.
1202
1203       CPAN::Bundle::force($method,@args)
1204           Forces CPAN to perform a task that it normally would have refused
1205           to do. Force takes as arguments a method name to be called and any
1206           number of additional arguments that should be passed to the called
1207           method.  The internals of the object get the needed changes so that
1208           CPAN.pm does not refuse to take the action. The "force" is passed
1209           recursively to all contained objects. See also the section above on
1210           the "force" and the "fforce" pragma.
1211
1212       CPAN::Bundle::get()
1213           Recursively runs the "get" method on all items contained in the
1214           bundle
1215
1216       CPAN::Bundle::inst_file()
1217           Returns the highest installed version of the bundle in either @INC
1218           or "$CPAN::Config->{cpan_home}". Note that this is different from
1219           CPAN::Module::inst_file.
1220
1221       CPAN::Bundle::inst_version()
1222           Like CPAN::Bundle::inst_file, but returns the $VERSION
1223
1224       CPAN::Bundle::uptodate()
1225           Returns 1 if the bundle itself and all its members are uptodate.
1226
1227       CPAN::Bundle::install()
1228           Recursively runs the "install" method on all items contained in the
1229           bundle
1230
1231       CPAN::Bundle::make()
1232           Recursively runs the "make" method on all items contained in the
1233           bundle
1234
1235       CPAN::Bundle::readme()
1236           Recursively runs the "readme" method on all items contained in the
1237           bundle
1238
1239       CPAN::Bundle::test()
1240           Recursively runs the "test" method on all items contained in the
1241           bundle
1242
1243       CPAN::Distribution::as_glimpse()
1244           Returns a one-line description of the distribution
1245
1246       CPAN::Distribution::as_string()
1247           Returns a multi-line description of the distribution
1248
1249       CPAN::Distribution::author
1250           Returns the CPAN::Author object of the maintainer who uploaded this
1251           distribution
1252
1253       CPAN::Distribution::pretty_id()
1254           Returns a string of the form "AUTHORID/TARBALL", where AUTHORID is
1255           the author's PAUSE ID and TARBALL is the distribution filename.
1256
1257       CPAN::Distribution::base_id()
1258           Returns the distribution filename without any archive suffix.  E.g
1259           "Foo-Bar-0.01"
1260
1261       CPAN::Distribution::clean()
1262           Changes to the directory where the distribution has been unpacked
1263           and runs "make clean" there.
1264
1265       CPAN::Distribution::containsmods()
1266           Returns a list of IDs of modules contained in a distribution file.
1267           Works only for distributions listed in the
1268           02packages.details.txt.gz file. This typically means that just most
1269           recent version of a distribution is covered.
1270
1271       CPAN::Distribution::cvs_import()
1272           Changes to the directory where the distribution has been unpacked
1273           and runs something like
1274
1275               cvs -d $cvs_root import -m $cvs_log $cvs_dir $userid v$version
1276
1277           there.
1278
1279       CPAN::Distribution::dir()
1280           Returns the directory into which this distribution has been
1281           unpacked.
1282
1283       CPAN::Distribution::force($method,@args)
1284           Forces CPAN to perform a task that it normally would have refused
1285           to do. Force takes as arguments a method name to be called and any
1286           number of additional arguments that should be passed to the called
1287           method.  The internals of the object get the needed changes so that
1288           CPAN.pm does not refuse to take the action. See also the section
1289           above on the "force" and the "fforce" pragma.
1290
1291       CPAN::Distribution::get()
1292           Downloads the distribution from CPAN and unpacks it. Does nothing
1293           if the distribution has already been downloaded and unpacked within
1294           the current session.
1295
1296       CPAN::Distribution::install()
1297           Changes to the directory where the distribution has been unpacked
1298           and runs the external command "make install" there. If "make" has
1299           not yet been run, it will be run first. A "make test" is issued in
1300           any case and if this fails, the install is cancelled. The
1301           cancellation can be avoided by letting "force" run the "install"
1302           for you.
1303
1304           This install method only has the power to install the distribution
1305           if there are no dependencies in the way. To install an object along
1306           with all its dependencies, use CPAN::Shell->install.
1307
1308           Note that install() gives no meaningful return value. See
1309           uptodate().
1310
1311       CPAN::Distribution::install_tested()
1312           Install all distributions that have tested sucessfully but not yet
1313           installed. See also "is_tested".
1314
1315       CPAN::Distribution::isa_perl()
1316           Returns 1 if this distribution file seems to be a perl
1317           distribution.  Normally this is derived from the file name only,
1318           but the index from CPAN can contain a hint to achieve a return
1319           value of true for other filenames too.
1320
1321       CPAN::Distribution::look()
1322           Changes to the directory where the distribution has been unpacked
1323           and opens a subshell there. Exiting the subshell returns.
1324
1325       CPAN::Distribution::make()
1326           First runs the "get" method to make sure the distribution is
1327           downloaded and unpacked. Changes to the directory where the
1328           distribution has been unpacked and runs the external commands "perl
1329           Makefile.PL" or "perl Build.PL" and "make" there.
1330
1331       CPAN::Distribution::perldoc()
1332           Downloads the pod documentation of the file associated with a
1333           distribution (in HTML format) and runs it through the external
1334           command lynx specified in "$CPAN::Config->{lynx}". If lynx isn't
1335           available, it converts it to plain text with the external command
1336           html2text and runs it through the pager specified in
1337           "$CPAN::Config->{pager}".
1338
1339       CPAN::Distribution::prefs()
1340           Returns the hash reference from the first matching YAML file that
1341           the user has deposited in the "prefs_dir/" directory. The first
1342           succeeding match wins. The files in the "prefs_dir/" are processed
1343           alphabetically, and the canonical distroname (e.g.
1344           AUTHOR/Foo-Bar-3.14.tar.gz) is matched against the regular
1345           expressions stored in the $root->{match}{distribution} attribute
1346           value.  Additionally all module names contained in a distribution
1347           are matched against the regular expressions in the
1348           $root->{match}{module} attribute value. The two match values are
1349           ANDed together. Each of the two attributes are optional.
1350
1351       CPAN::Distribution::prereq_pm()
1352           Returns the hash reference that has been announced by a
1353           distribution as the "requires" and "build_requires" elements. These
1354           can be declared either by the "META.yml" (if authoritative) or can
1355           be deposited after the run of "Build.PL" in the file
1356           "./_build/prereqs" or after the run of "Makfile.PL" written as the
1357           "PREREQ_PM" hash in a comment in the produced "Makefile". Note:
1358           this method only works after an attempt has been made to "make" the
1359           distribution. Returns undef otherwise.
1360
1361       CPAN::Distribution::readme()
1362           Downloads the README file associated with a distribution and runs
1363           it through the pager specified in "$CPAN::Config->{pager}".
1364
1365       CPAN::Distribution::reports()
1366           Downloads report data for this distribution from
1367           www.cpantesters.org and displays a subset of them.
1368
1369       CPAN::Distribution::read_yaml()
1370           Returns the content of the META.yml of this distro as a hashref.
1371           Note: works only after an attempt has been made to "make" the
1372           distribution.  Returns undef otherwise. Also returns undef if the
1373           content of META.yml is not authoritative. (The rules about what
1374           exactly makes the content authoritative are still in flux.)
1375
1376       CPAN::Distribution::test()
1377           Changes to the directory where the distribution has been unpacked
1378           and runs "make test" there.
1379
1380       CPAN::Distribution::uptodate()
1381           Returns 1 if all the modules contained in the distribution are
1382           uptodate. Relies on containsmods.
1383
1384       CPAN::Index::force_reload()
1385           Forces a reload of all indices.
1386
1387       CPAN::Index::reload()
1388           Reloads all indices if they have not been read for more than
1389           "$CPAN::Config->{index_expire}" days.
1390
1391       CPAN::InfoObj::dump()
1392           CPAN::Author, CPAN::Bundle, CPAN::Module, and CPAN::Distribution
1393           inherit this method. It prints the data structure associated with
1394           an object. Useful for debugging. Note: the data structure is
1395           considered internal and thus subject to change without notice.
1396
1397       CPAN::Module::as_glimpse()
1398           Returns a one-line description of the module in four columns: The
1399           first column contains the word "Module", the second column consists
1400           of one character: an equals sign if this module is already
1401           installed and uptodate, a less-than sign if this module is
1402           installed but can be upgraded, and a space if the module is not
1403           installed. The third column is the name of the module and the
1404           fourth column gives maintainer or distribution information.
1405
1406       CPAN::Module::as_string()
1407           Returns a multi-line description of the module
1408
1409       CPAN::Module::clean()
1410           Runs a clean on the distribution associated with this module.
1411
1412       CPAN::Module::cpan_file()
1413           Returns the filename on CPAN that is associated with the module.
1414
1415       CPAN::Module::cpan_version()
1416           Returns the latest version of this module available on CPAN.
1417
1418       CPAN::Module::cvs_import()
1419           Runs a cvs_import on the distribution associated with this module.
1420
1421       CPAN::Module::description()
1422           Returns a 44 character description of this module. Only available
1423           for modules listed in The Module List
1424           (CPAN/modules/00modlist.long.html or 00modlist.long.txt.gz)
1425
1426       CPAN::Module::distribution()
1427           Returns the CPAN::Distribution object that contains the current
1428           version of this module.
1429
1430       CPAN::Module::dslip_status()
1431           Returns a hash reference. The keys of the hash are the letters "D",
1432           "S", "L", "I", and <P>, for development status, support level,
1433           language, interface and public licence respectively. The data for
1434           the DSLIP status are collected by pause.perl.org when authors
1435           register their namespaces. The values of the 5 hash elements are
1436           one-character words whose meaning is described in the table below.
1437           There are also 5 hash elements "DV", "SV", "LV", "IV", and <PV>
1438           that carry a more verbose value of the 5 status variables.
1439
1440           Where the 'DSLIP' characters have the following meanings:
1441
1442             D - Development Stage  (Note: *NO IMPLIED TIMESCALES*):
1443               i   - Idea, listed to gain consensus or as a placeholder
1444               c   - under construction but pre-alpha (not yet released)
1445               a/b - Alpha/Beta testing
1446               R   - Released
1447               M   - Mature (no rigorous definition)
1448               S   - Standard, supplied with Perl 5
1449
1450             S - Support Level:
1451               m   - Mailing-list
1452               d   - Developer
1453               u   - Usenet newsgroup comp.lang.perl.modules
1454               n   - None known, try comp.lang.perl.modules
1455               a   - abandoned; volunteers welcome to take over maintainance
1456
1457             L - Language Used:
1458               p   - Perl-only, no compiler needed, should be platform independent
1459               c   - C and perl, a C compiler will be needed
1460               h   - Hybrid, written in perl with optional C code, no compiler needed
1461               +   - C++ and perl, a C++ compiler will be needed
1462               o   - perl and another language other than C or C++
1463
1464             I - Interface Style
1465               f   - plain Functions, no references used
1466               h   - hybrid, object and function interfaces available
1467               n   - no interface at all (huh?)
1468               r   - some use of unblessed References or ties
1469               O   - Object oriented using blessed references and/or inheritance
1470
1471             P - Public License
1472               p   - Standard-Perl: user may choose between GPL and Artistic
1473               g   - GPL: GNU General Public License
1474               l   - LGPL: "GNU Lesser General Public License" (previously known as
1475                     "GNU Library General Public License")
1476               b   - BSD: The BSD License
1477               a   - Artistic license alone
1478               2   - Artistic license 2.0 or later
1479               o   - open source: appoved by www.opensource.org
1480               d   - allows distribution without restrictions
1481               r   - restricted distribtion
1482               n   - no license at all
1483
1484       CPAN::Module::force($method,@args)
1485           Forces CPAN to perform a task it would normally refuse to do. Force
1486           takes as arguments a method name to be invoked and any number of
1487           additional arguments to pass that method.  The internals of the
1488           object get the needed changes so that CPAN.pm does not refuse to
1489           take the action. See also the section above on the "force" and the
1490           "fforce" pragma.
1491
1492       CPAN::Module::get()
1493           Runs a get on the distribution associated with this module.
1494
1495       CPAN::Module::inst_file()
1496           Returns the filename of the module found in @INC. The first file
1497           found is reported, just as perl itself stops searching @INC once it
1498           finds a module.
1499
1500       CPAN::Module::available_file()
1501           Returns the filename of the module found in PERL5LIB or @INC. The
1502           first file found is reported. The advantage of this method over
1503           "inst_file" is that modules that have been tested but not yet
1504           installed are included because PERL5LIB keeps track of tested
1505           modules.
1506
1507       CPAN::Module::inst_version()
1508           Returns the version number of the installed module in readable
1509           format.
1510
1511       CPAN::Module::available_version()
1512           Returns the version number of the available module in readable
1513           format.
1514
1515       CPAN::Module::install()
1516           Runs an "install" on the distribution associated with this module.
1517
1518       CPAN::Module::look()
1519           Changes to the directory where the distribution associated with
1520           this module has been unpacked and opens a subshell there. Exiting
1521           the subshell returns.
1522
1523       CPAN::Module::make()
1524           Runs a "make" on the distribution associated with this module.
1525
1526       CPAN::Module::manpage_headline()
1527           If module is installed, peeks into the module's manpage, reads the
1528           headline, and returns it. Moreover, if the module has been
1529           downloaded within this session, does the equivalent on the
1530           downloaded module even if it hasn't been installed yet.
1531
1532       CPAN::Module::perldoc()
1533           Runs a "perldoc" on this module.
1534
1535       CPAN::Module::readme()
1536           Runs a "readme" on the distribution associated with this module.
1537
1538       CPAN::Module::reports()
1539           Calls the reports() method on the associated distribution object.
1540
1541       CPAN::Module::test()
1542           Runs a "test" on the distribution associated with this module.
1543
1544       CPAN::Module::uptodate()
1545           Returns 1 if the module is installed and up-to-date.
1546
1547       CPAN::Module::userid()
1548           Returns the author's ID of the module.
1549
1550   Cache Manager
1551       Currently the cache manager only keeps track of the build directory
1552       ($CPAN::Config->{build_dir}). It is a simple FIFO mechanism that
1553       deletes complete directories below "build_dir" as soon as the size of
1554       all directories there gets bigger than $CPAN::Config->{build_cache} (in
1555       MB). The contents of this cache may be used for later re-installations
1556       that you intend to do manually, but will never be trusted by CPAN
1557       itself. This is due to the fact that the user might use these
1558       directories for building modules on different architectures.
1559
1560       There is another directory ($CPAN::Config->{keep_source_where}) where
1561       the original distribution files are kept. This directory is not covered
1562       by the cache manager and must be controlled by the user. If you choose
1563       to have the same directory as build_dir and as keep_source_where
1564       directory, then your sources will be deleted with the same fifo
1565       mechanism.
1566
1567   Bundles
1568       A bundle is just a perl module in the namespace Bundle:: that does not
1569       define any functions or methods. It usually only contains
1570       documentation.
1571
1572       It starts like a perl module with a package declaration and a $VERSION
1573       variable. After that the pod section looks like any other pod with the
1574       only difference being that one special pod section exists starting with
1575       (verbatim):
1576
1577           =head1 CONTENTS
1578
1579       In this pod section each line obeys the format
1580
1581               Module_Name [Version_String] [- optional text]
1582
1583       The only required part is the first field, the name of a module (e.g.
1584       Foo::Bar, ie. not the name of the distribution file). The rest of the
1585       line is optional. The comment part is delimited by a dash just as in
1586       the man page header.
1587
1588       The distribution of a bundle should follow the same convention as other
1589       distributions.
1590
1591       Bundles are treated specially in the CPAN package. If you say 'install
1592       Bundle::Tkkit' (assuming such a bundle exists), CPAN will install all
1593       the modules in the CONTENTS section of the pod. You can install your
1594       own Bundles locally by placing a conformant Bundle file somewhere into
1595       your @INC path. The autobundle() command which is available in the
1596       shell interface does that for you by including all currently installed
1597       modules in a snapshot bundle file.
1598

PREREQUISITES

1600       The CPAN program is trying to depend on as little as possible so the
1601       user can use it in hostile enviroment. It works better the more goodies
1602       the environment provides. For example if you try in the CPAN shell
1603
1604         install Bundle::CPAN
1605
1606       or
1607
1608         install Bundle::CPANxxl
1609
1610       you will find the shell more convenient than the bare shell before.
1611
1612       If you have a local mirror of CPAN and can access all files with
1613       "file:" URLs, then you only need a perl later than perl5.003 to run
1614       this module. Otherwise Net::FTP is strongly recommended. LWP may be
1615       required for non-UNIX systems, or if your nearest CPAN site is
1616       associated with a URL that is not "ftp:".
1617
1618       If you have neither Net::FTP nor LWP, there is a fallback mechanism
1619       implemented for an external ftp command or for an external lynx
1620       command.
1621

UTILITIES

1623   Finding packages and VERSION
1624       This module presumes that all packages on CPAN
1625
1626       · declare their $VERSION variable in an easy to parse manner. This
1627         prerequisite can hardly be relaxed because it consumes far too much
1628         memory to load all packages into the running program just to
1629         determine the $VERSION variable. Currently all programs that are
1630         dealing with version use something like this
1631
1632             perl -MExtUtils::MakeMaker -le \
1633                 'print MM->parse_version(shift)' filename
1634
1635         If you are author of a package and wonder if your $VERSION can be
1636         parsed, please try the above method.
1637
1638       · come as compressed or gzipped tarfiles or as zip files and contain a
1639         "Makefile.PL" or "Build.PL" (well, we try to handle a bit more, but
1640         with little enthusiasm).
1641
1642   Debugging
1643       Debugging this module is more than a bit complex due to interference
1644       from the software producing the indices on CPAN, the mirroring process
1645       on CPAN, packaging, configuration, synchronicity, and even (gasp!) due
1646       to bugs within the CPAN.pm module itself.
1647
1648       For debugging the code of CPAN.pm itself in interactive mode, some
1649       debugging aid can be turned on for most packages within CPAN.pm with
1650       one of
1651
1652       o debug package...
1653         sets debug mode for packages.
1654
1655       o debug -package...
1656         unsets debug mode for packages.
1657
1658       o debug all
1659         turns debugging on for all packages.
1660
1661       o debug number
1662
1663       which sets the debugging packages directly. Note that "o debug 0" turns
1664       debugging off.
1665
1666       What seems a successful strategy is the combination of "reload cpan"
1667       and the debugging switches. Add a new debug statement while running in
1668       the shell and then issue a "reload cpan" and see the new debugging
1669       messages immediately without losing the current context.
1670
1671       "o debug" without an argument lists the valid package names and the
1672       current set of packages in debugging mode. "o debug" has built-in
1673       completion support.
1674
1675       For debugging of CPAN data there is the "dump" command which takes the
1676       same arguments as make/test/install and outputs each object's
1677       Data::Dumper dump. If an argument looks like a perl variable and
1678       contains one of "$", "@" or "%", it is eval()ed and fed to Data::Dumper
1679       directly.
1680
1681   Floppy, Zip, Offline Mode
1682       CPAN.pm works nicely without network access, too. If you maintain
1683       machines that are not networked at all, you should consider working
1684       with "file:" URLs. You'll have to collect your modules somewhere first.
1685       So you might use CPAN.pm to put together all you need on a networked
1686       machine. Then copy the $CPAN::Config->{keep_source_where} (but not
1687       $CPAN::Config->{build_dir}) directory on a floppy. This floppy is kind
1688       of a personal CPAN. CPAN.pm on the non-networked machines works nicely
1689       with this floppy. See also below the paragraph about CD-ROM support.
1690
1691   Basic Utilities for Programmers
1692       has_inst($module)
1693         Returns true if the module is installed. Used to load all modules
1694         into the running CPAN.pm that are considered optional. The config
1695         variable "dontload_list" intercepts the "has_inst()" call such that
1696         an optional module is not loaded despite being available. For
1697         example, the following command will prevent "YAML.pm" from being
1698         loaded:
1699
1700             cpan> o conf dontload_list push YAML
1701
1702         See the source for details.
1703
1704       has_usable($module)
1705         Returns true if the module is installed and in a usable state. Only
1706         useful for a handful of modules that are used internally. See the
1707         source for details.
1708
1709       instance($module)
1710         The constructor for all the singletons used to represent modules,
1711         distributions, authors, and bundles. If the object already exists,
1712         this method returns the object; otherwise, it calls the constructor.
1713

SECURITY

1715       There's no strong security layer in CPAN.pm. CPAN.pm helps you to
1716       install foreign, unmasked, unsigned code on your machine. We compare to
1717       a checksum that comes from the net just as the distribution file
1718       itself. But we try to make it easy to add security on demand:
1719
1720   Cryptographically signed modules
1721       Since release 1.77, CPAN.pm has been able to verify cryptographically
1722       signed module distributions using Module::Signature.  The CPAN modules
1723       can be signed by their authors, thus giving more security.  The simple
1724       unsigned MD5 checksums that were used before by CPAN protect mainly
1725       against accidental file corruption.
1726
1727       You will need to have Module::Signature installed, which in turn
1728       requires that you have at least one of Crypt::OpenPGP module or the
1729       command-line gpg tool installed.
1730
1731       You will also need to be able to connect over the Internet to the
1732       public keyservers, like pgp.mit.edu, and their port 11731 (the HKP
1733       protocol).
1734
1735       The configuration parameter check_sigs is there to turn signature
1736       checking on or off.
1737

EXPORT

1739       Most functions in package CPAN are exported by default. The reason for
1740       this is that the primary use is intended for the cpan shell or for one-
1741       liners.
1742

ENVIRONMENT

1744       When the CPAN shell enters a subshell via the look command, it sets the
1745       environment CPAN_SHELL_LEVEL to 1, or increments that variable if it is
1746       already set.
1747
1748       When CPAN runs, it sets the environment variable PERL5_CPAN_IS_RUNNING
1749       to the ID of the running process. It also sets
1750       PERL5_CPANPLUS_IS_RUNNING to prevent runaway processes which could
1751       happen with older versions of Module::Install.
1752
1753       When running "perl Makefile.PL", the environment variable
1754       "PERL5_CPAN_IS_EXECUTING" is set to the full path of the "Makefile.PL"
1755       that is being executed. This prevents runaway processes with newer
1756       versions of Module::Install.
1757
1758       When the config variable ftp_passive is set, all downloads will be run
1759       with the environment variable FTP_PASSIVE set to this value. This is in
1760       general a good idea as it influences both Net::FTP and LWP based
1761       connections. The same effect can be achieved by starting the cpan shell
1762       with this environment variable set. For Net::FTP alone, one can also
1763       always set passive mode by running libnetcfg.
1764

POPULATE AN INSTALLATION WITH LOTS OF MODULES

1766       Populating a freshly installed perl with one's favorite modules is
1767       pretty easy if you maintain a private bundle definition file. To get a
1768       useful blueprint of a bundle definition file, the command autobundle
1769       can be used on the CPAN shell command line. This command writes a
1770       bundle definition file for all modules installed for the current perl
1771       interpreter. It's recommended to run this command once only, and from
1772       then on maintain the file manually under a private name, say
1773       Bundle/my_bundle.pm. With a clever bundle file you can then simply say
1774
1775           cpan> install Bundle::my_bundle
1776
1777       then answer a few questions and go out for coffee (possibly even in a
1778       different city).
1779
1780       Maintaining a bundle definition file means keeping track of two things:
1781       dependencies and interactivity. CPAN.pm sometimes fails on calculating
1782       dependencies because not all modules define all MakeMaker attributes
1783       correctly, so a bundle definition file should specify prerequisites as
1784       early as possible. On the other hand, it's annoying that so many
1785       distributions need some interactive configuring. So what you can try to
1786       accomplish in your private bundle file is to have the packages that
1787       need to be configured early in the file and the gentle ones later, so
1788       you can go out for cofeee after a few minutes and leave CPAN.pm to
1789       churn away untended.
1790

WORKING WITH CPAN.pm BEHIND FIREWALLS

1792       Thanks to Graham Barr for contributing the following paragraphs about
1793       the interaction between perl, and various firewall configurations. For
1794       further information on firewalls, it is recommended to consult the
1795       documentation that comes with the ncftp program. If you are unable to
1796       go through the firewall with a simple Perl setup, it is likely that you
1797       can configure ncftp so that it works through your firewall.
1798
1799   Three basic types of firewalls
1800       Firewalls can be categorized into three basic types.
1801
1802       http firewall
1803           This is when the firewall machine runs a web server, and to access
1804           the outside world, you must do so via that web server. If you set
1805           environment variables like http_proxy or ftp_proxy to values
1806           beginning with http://, or in your web browser you've proxy
1807           information set, then you know you are running behind an http
1808           firewall.
1809
1810           To access servers outside these types of firewalls with perl (even
1811           for ftp), you need LWP.
1812
1813       ftp firewall
1814           This where the firewall machine runs an ftp server. This kind of
1815           firewall will only let you access ftp servers outside the firewall.
1816           This is usually done by connecting to the firewall with ftp, then
1817           entering a username like "user@outside.host.com".
1818
1819           To access servers outside these type of firewalls with perl, you
1820           need Net::FTP.
1821
1822       One-way visibility
1823           One-way visibility means these firewalls try to make themselves
1824           invisible to users inside the firewall. An FTP data connection is
1825           normally created by sending your IP address to the remote server
1826           and then listening for the return connection. But the remote server
1827           will not be able to connect to you because of the firewall. For
1828           these types of firewall, FTP connections need to be done in a
1829           passive mode.
1830
1831           There are two that I can think off.
1832
1833           SOCKS
1834               If you are using a SOCKS firewall, you will need to compile
1835               perl and link it with the SOCKS library.  This is what is
1836               normally called a 'socksified' perl. With this executable you
1837               will be able to connect to servers outside the firewall as if
1838               it were not there.
1839
1840           IP Masquerade
1841               This is when the firewall implemented in the kernel (via NAT,
1842               or networking address translation), it allows you to hide a
1843               complete network behind one IP address. With this firewall no
1844               special compiling is needed as you can access hosts directly.
1845
1846               For accessing ftp servers behind such firewalls you usually
1847               need to set the environment variable "FTP_PASSIVE" or the
1848               config variable ftp_passive to a true value.
1849
1850   Configuring lynx or ncftp for going through a firewall
1851       If you can go through your firewall with e.g. lynx, presumably with a
1852       command such as
1853
1854           /usr/local/bin/lynx -pscott:tiger
1855
1856       then you would configure CPAN.pm with the command
1857
1858           o conf lynx "/usr/local/bin/lynx -pscott:tiger"
1859
1860       That's all. Similarly for ncftp or ftp, you would configure something
1861       like
1862
1863           o conf ncftp "/usr/bin/ncftp -f /home/scott/ncftplogin.cfg"
1864
1865       Your mileage may vary...
1866

FAQ

1868       1)  I installed a new version of module X but CPAN keeps saying, I have
1869           the old version installed
1870
1871           Probably you do have the old version installed. This can happen if
1872           a module installs itself into a different directory in the @INC
1873           path than it was previously installed. This is not really a CPAN.pm
1874           problem, you would have the same problem when installing the module
1875           manually. The easiest way to prevent this behaviour is to add the
1876           argument "UNINST=1" to the "make install" call, and that is why
1877           many people add this argument permanently by configuring
1878
1879             o conf make_install_arg UNINST=1
1880
1881       2)  So why is UNINST=1 not the default?
1882
1883           Because there are people who have their precise expectations about
1884           who may install where in the @INC path and who uses which @INC
1885           array. In fine tuned environments "UNINST=1" can cause damage.
1886
1887       3)  I want to clean up my mess, and install a new perl along with all
1888           modules I have. How do I go about it?
1889
1890           Run the autobundle command for your old perl and optionally rename
1891           the resulting bundle file (e.g. Bundle/mybundle.pm), install the
1892           new perl with the Configure option prefix, e.g.
1893
1894               ./Configure -Dprefix=/usr/local/perl-5.6.78.9
1895
1896           Install the bundle file you produced in the first step with
1897           something like
1898
1899               cpan> install Bundle::mybundle
1900
1901           and you're done.
1902
1903       4)  When I install bundles or multiple modules with one command there
1904           is too much output to keep track of.
1905
1906           You may want to configure something like
1907
1908             o conf make_arg "| tee -ai /root/.cpan/logs/make.out"
1909             o conf make_install_arg "| tee -ai /root/.cpan/logs/make_install.out"
1910
1911           so that STDOUT is captured in a file for later inspection.
1912
1913       5)  I am not root, how can I install a module in a personal directory?
1914
1915           First of all, you will want to use your own configuration, not the
1916           one that your root user installed. If you do not have permission to
1917           write in the cpan directory that root has configured, you will be
1918           asked if you want to create your own config. Answering "yes" will
1919           bring you into CPAN's configuration stage, using the system config
1920           for all defaults except things that have to do with CPAN's work
1921           directory, saving your choices to your MyConfig.pm file.
1922
1923           You can also manually initiate this process with the following
1924           command:
1925
1926               % perl -MCPAN -e 'mkmyconfig'
1927
1928           or by running
1929
1930               mkmyconfig
1931
1932           from the CPAN shell.
1933
1934           You will most probably also want to configure something like this:
1935
1936             o conf makepl_arg "LIB=~/myperl/lib \
1937                               INSTALLMAN1DIR=~/myperl/man/man1 \
1938                               INSTALLMAN3DIR=~/myperl/man/man3 \
1939                               INSTALLSCRIPT=~/myperl/bin \
1940                               INSTALLBIN=~/myperl/bin"
1941
1942           and then the equivalent command for Module::Build, which is
1943
1944             o conf mbuildpl_arg "--lib=~/myperl/lib \
1945                               --installman1dir=~/myperl/man/man1 \
1946                               --installman3dir=~/myperl/man/man3 \
1947                               --installscript=~/myperl/bin \
1948                               --installbin=~/myperl/bin"
1949
1950           You can make this setting permanent like all "o conf" settings with
1951           "o conf commit" or by setting "auto_commit" beforehand.
1952
1953           You will have to add ~/myperl/man to the MANPATH environment
1954           variable and also tell your perl programs to look into
1955           ~/myperl/lib, e.g. by including
1956
1957             use lib "$ENV{HOME}/myperl/lib";
1958
1959           or setting the PERL5LIB environment variable.
1960
1961           While we're speaking about $ENV{HOME}, it might be worth
1962           mentioning, that for Windows we use the File::HomeDir module that
1963           provides an equivalent to the concept of the home directory on
1964           Unix.
1965
1966           Another thing you should bear in mind is that the UNINST parameter
1967           can be dangerous when you are installing into a private area
1968           because you might accidentally remove modules that other people
1969           depend on that are not using the private area.
1970
1971       6)  How to get a package, unwrap it, and make a change before building
1972           it?
1973
1974           Have a look at the "look" (!) command.
1975
1976       7)  I installed a Bundle and had a couple of fails. When I retried,
1977           everything resolved nicely. Can this be fixed to work on first try?
1978
1979           The reason for this is that CPAN does not know the dependencies of
1980           all modules when it starts out. To decide about the additional
1981           items to install, it just uses data found in the META.yml file or
1982           the generated Makefile. An undetected missing piece breaks the
1983           process. But it may well be that your Bundle installs some
1984           prerequisite later than some depending item and thus your second
1985           try is able to resolve everything.  Please note, CPAN.pm does not
1986           know the dependency tree in advance and cannot sort the queue of
1987           things to install in a topologically correct order. It resolves
1988           perfectly well if all modules declare the prerequisites correctly
1989           with the PREREQ_PM attribute to MakeMaker or the "requires" stanza
1990           of Module::Build. For bundles which fail and you need to install
1991           often, it is recommended to sort the Bundle definition file
1992           manually.
1993
1994       8)  In our intranet, we have many modules for internal use. How can I
1995           integrate these modules with CPAN.pm but without uploading the
1996           modules to CPAN?
1997
1998           Have a look at the CPAN::Site module.
1999
2000       9)  When I run CPAN's shell, I get an error message about things in my
2001           "/etc/inputrc" (or "~/.inputrc") file.
2002
2003           These are readline issues and can only be fixed by studying
2004           readline configuration on your architecture and adjusting the
2005           referenced file accordingly. Please make a backup of the
2006           "/etc/inputrc" or "~/.inputrc" and edit them. Quite often harmless
2007           changes like uppercasing or lowercasing some arguments solves the
2008           problem.
2009
2010       10) Some authors have strange characters in their names.
2011
2012           Internally CPAN.pm uses the UTF-8 charset. If your terminal is
2013           expecting ISO-8859-1 charset, a converter can be activated by
2014           setting term_is_latin to a true value in your config file. One way
2015           of doing so would be
2016
2017               cpan> o conf term_is_latin 1
2018
2019           If other charset support is needed, please file a bugreport against
2020           CPAN.pm at rt.cpan.org and describe your needs. Maybe we can extend
2021           the support or maybe UTF-8 terminals become widely available.
2022
2023           Note: this config variable is deprecated and will be removed in a
2024           future version of CPAN.pm. It will be replaced with the conventions
2025           around the family of $LANG and $LC_* environment variables.
2026
2027       11) When an install fails for some reason and then I correct the error
2028           condition and retry, CPAN.pm refuses to install the module, saying
2029           "Already tried without success".
2030
2031           Use the force pragma like so
2032
2033             force install Foo::Bar
2034
2035           Or you can use
2036
2037             look Foo::Bar
2038
2039           and then "make install" directly in the subshell.
2040
2041       12) How do I install a "DEVELOPER RELEASE" of a module?
2042
2043           By default, CPAN will install the latest non-developer release of a
2044           module. If you want to install a dev release, you have to specify
2045           the partial path starting with the author id to the tarball you
2046           wish to install, like so:
2047
2048               cpan> install KWILLIAMS/Module-Build-0.27_07.tar.gz
2049
2050           Note that you can use the "ls" command to get this path listed.
2051
2052       13) How do I install a module and all its dependencies from the
2053           commandline, without being prompted for anything, despite my CPAN
2054           configuration (or lack thereof)?
2055
2056           CPAN uses ExtUtils::MakeMaker's prompt() function to ask its
2057           questions, so if you set the PERL_MM_USE_DEFAULT environment
2058           variable, you shouldn't be asked any questions at all (assuming the
2059           modules you are installing are nice about obeying that variable as
2060           well):
2061
2062               % PERL_MM_USE_DEFAULT=1 perl -MCPAN -e 'install My::Module'
2063
2064       14) How do I create a Module::Build based Build.PL derived from an
2065           ExtUtils::MakeMaker focused Makefile.PL?
2066
2067           http://search.cpan.org/dist/Module-Build-Convert/
2068
2069       15) I'm frequently irritated with the CPAN shell's inability to help me
2070           select a good mirror.
2071
2072           The urllist config parameter is yours. You can add and remove sites
2073           at will. You should find out which sites have the best
2074           uptodateness, bandwidth, reliability, etc. and are topologically
2075           close to you. Some people prefer fast downloads, others
2076           uptodateness, others reliability.  You decide which to try in which
2077           order.
2078
2079           Henk P. Penning maintains a site that collects data about CPAN
2080           sites:
2081
2082             http://www.cs.uu.nl/people/henkp/mirmon/cpan.html
2083
2084           Also, feel free to play with experimental features. Run
2085
2086             o conf init randomize_urllist ftpstats_period ftpstats_size
2087
2088           and choose your favorite parameters. After a few downloads running
2089           the "hosts" command will probably assist you in choosing the best
2090           mirror sites.
2091
2092       16) Why do I get asked the same questions every time I start the shell?
2093
2094           You can make your configuration changes permanent by calling the
2095           command "o conf commit". Alternatively set the "auto_commit"
2096           variable to true by running "o conf init auto_commit" and answering
2097           the following question with yes.
2098
2099       17) Older versions of CPAN.pm had the original root directory of all
2100           tarballs in the build directory. Now there are always random
2101           characters appended to these directory names. Why was this done?
2102
2103           The random characters are provided by File::Temp and ensure that
2104           each module's individual build directory is unique. This makes
2105           running CPAN.pm in concurrent processes simultaneously safe.
2106
2107       18) Speaking of the build directory. Do I have to clean it up myself?
2108
2109           You have the choice to set the config variable "scan_cache" to
2110           "never". Then you must clean it up yourself. The other possible
2111           value, "atstart" only cleans up the build directory when you start
2112           the CPAN shell. If you never start up the CPAN shell, you probably
2113           also have to clean up the build directory yourself.
2114

COMPATIBILITY

2116   OLD PERL VERSIONS
2117       CPAN.pm is regularly tested to run under 5.004, 5.005, and assorted
2118       newer versions. It is getting more and more difficult to get the
2119       minimal prerequisites working on older perls. It is close to impossible
2120       to get the whole Bundle::CPAN working there. If you're in the position
2121       to have only these old versions, be advised that CPAN is designed to
2122       work fine without the Bundle::CPAN installed.
2123
2124       To get things going, note that GBARR/Scalar-List-Utils-1.18.tar.gz is
2125       compatible with ancient perls and that File::Temp is listed as a
2126       prerequisite but CPAN has reasonable workarounds if it is missing.
2127
2128   CPANPLUS
2129       This module and its competitor, the CPANPLUS module, are both much
2130       cooler than the other. CPAN.pm is older. CPANPLUS was designed to be
2131       more modular, but it was never intended to be compatible with CPAN.pm.
2132

SECURITY ADVICE

2134       This software enables you to upgrade software on your computer and so
2135       is inherently dangerous because the newly installed software may
2136       contain bugs and may alter the way your computer works or even make it
2137       unusable. Please consider backing up your data before every upgrade.
2138

BUGS

2140       Please report bugs via <http://rt.cpan.org/>
2141
2142       Before submitting a bug, please make sure that the traditional method
2143       of building a Perl module package from a shell by following the
2144       installation instructions of that package still works in your
2145       environment.
2146

AUTHOR

2148       Andreas Koenig "<andk@cpan.org>"
2149

LICENSE

2151       This program is free software; you can redistribute it and/or modify it
2152       under the same terms as Perl itself.
2153
2154       See <http://www.perl.com/perl/misc/Artistic.html>
2155

TRANSLATIONS

2157       Kawai,Takanori provides a Japanese translation of a very old version of
2158       this manpage at
2159       <http://homepage3.nifty.com/hippo2000/perltips/CPAN.htm>
2160

SEE ALSO

2162       Many people enter the CPAN shell by running the cpan utility program
2163       which is installed in the same directory as perl itself. So if you have
2164       this directory in your PATH variable (or some equivalent in your
2165       operating system) then typing "cpan" in a console window will work for
2166       you as well. Above that the utility provides several commandline
2167       shortcuts.
2168
2169
2170
2171perl v5.12.4                      2011-06-07                         CPAN(3pm)
Impressum