CPAN man page on UnixWare

Man page or keyword search:  
man Server   3616 pages
apropos Keyword Search (all sections)
Output format
UnixWare logo
[printable version]

CPAN(3)		      User Contributed Perl Documentation	       CPAN(3)

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

       Interactive mode:

	 perl -MCPAN -e shell;

       Batch mode:

	 use CPAN;

	 # modules:

	 $mod = "Acme::Meta";
	 install $mod;
	 CPAN::Shell->install($mod);			# same thing
	 CPAN::Shell->expandany($mod)->install;		# same thing
	 CPAN::Shell->expand("Module",$mod)->install;	# same thing
	   ->distribution->install;			# same thing

	 # distributions:

	 $distro = "NWCLARK/Acme-Meta-0.01.tar.gz";
	 install $distro;				 # same thing
	 CPAN::Shell->install($distro);			 # same thing
	 CPAN::Shell->expandany($distro)->install;	 # same thing
	 CPAN::Shell->expand("Module",$distro)->install; # same thing

       This module will eventually be replaced by CPANPLUS. CPANPLUS is kind
       of a modern rewrite from ground up with greater extensibility and more
       features but no full compatibility. If you're new to, you prob‐
       ably should investigate if CPANPLUS is the better choice for you.

       If you're already used to you're welcome to continue using it.
       I intend to support it until somebody convinces me that there is a both
       superior and sufficiently compatible drop-in replacement.

COMPATIBILITY is regularly tested to run under 5.004, 5.005, and assorted
       newer versions. It is getting more and more difficult to get the mini‐
       mal prerequisites working on older perls. It is close to impossible to
       get the whole Bundle::CPAN working there. If you're in the position to
       have only these old versions, be advised that CPAN is designed to work
       fine without the Bundle::CPAN installed.

       To get things going, note that GBARR/Scalar-List-Utils-1.18.tar.gz is
       compatible with ancient perls and that File::Temp is listed as a pre‐
       requisite but CPAN has reasonable workarounds if it is missing.

       The CPAN module is designed to automate the make and install of perl
       modules and extensions. It includes some primitive searching capabili‐
       ties and knows how to use Net::FTP or LWP (or some external download
       clients) to fetch the raw data from the net.

       Modules are fetched from one or more of the mirrored CPAN (Comprehen‐
       sive Perl Archive Network) sites and unpacked in a dedicated directory.

       The CPAN module also supports the concept of named and versioned bun‐
       dles of modules. Bundles simplify the handling of sets of related mod‐
       ules. See Bundles below.

       The package contains a session manager and a cache manager. There is no
       status retained between sessions. The session manager keeps track of
       what has been fetched, built and installed in the current session. The
       cache manager keeps track of the disk space occupied by the make pro‐
       cesses and deletes excess space according to a simple FIFO mechanism.

       All methods provided are accessible in a programmer style and in an
       interactive shell style.

       Interactive Mode

       The interactive mode is entered by running

	   perl -MCPAN -e shell

       which puts you into a readline interface. You will have the most fun if
       you install Term::ReadKey and Term::ReadLine to enjoy both history and
       command completion.

       Once you are on the command line, type 'h' and the rest should be

       The function call "shell" takes two optional arguments, one is the
       prompt, the second is the default initial command line (the latter only
       works if a real ReadLine interface module is installed).

       The most common uses of the interactive modes are

       Searching for authors, bundles, distribution files and modules
	 There are corresponding one-letter commands "a", "b", "d", and "m"
	 for each of the four categories and another, "i" for any of the men‐
	 tioned four. Each of the four entities is implemented as a class with
	 slightly differing methods for displaying an object.

	 Arguments you pass to these commands are either strings exactly
	 matching the identification string of an object or regular expres‐
	 sions that are then matched case-insensitively against various
	 attributes of the objects. The parser recognizes a regular expression
	 only if you enclose it between two slashes.

	 The principle is that the number of found objects influences how an
	 item is displayed. If the search finds one item, the result is dis‐
	 played with the rather verbose method "as_string", but if we find
	 more than one, we display each object with the terse method

       make, test, install, clean  modules or distributions
	 These commands take any number of arguments and investigate what is
	 necessary to perform the action. If the argument is a distribution
	 file name (recognized by embedded slashes), it is processed. If it is
	 a module, CPAN determines the distribution file in which this module
	 is included and processes that, following any dependencies named in
	 the module's META.yml or Makefile.PL (this behavior is controlled by
	 the configuration parameter "prerequisites_policy".)

	 Any "make" or "test" are run unconditionally. An

	   install <distribution_file>

	 also is run unconditionally. But for

	   install <module>

	 CPAN checks if an install is actually needed for it and prints module
	 up to date in the case that the distribution file containing the mod‐
	 ule doesn't need to be updated.

	 CPAN also keeps track of what it has done within the current session
	 and doesn't try to build a package a second time regardless if it
	 succeeded or not. The "force" pragma may precede another command
	 (currently: "make", "test", or "install") and executes the command
	 from scratch and tries to continue in case of some errors.


	     cpan> install OpenGL
	     OpenGL is up to date.
	     cpan> force install OpenGL
	     Running make

	 The "notest" pragma may be set to skip the test part in the build


	     cpan> notest install Tk

	 A "clean" command results in a

	   make clean

	 being executed within the distribution file's working directory.

       get, readme, perldoc, look module or distribution
	 "get" downloads a distribution file without further action. "readme"
	 displays the README file of the associated distribution. "Look" gets
	 and untars (if not yet done) the distribution file, changes to the
	 appropriate directory and opens a subshell process in that directory.
	 "perldoc" displays the pod documentation of the module in html or
	 plain text format.

       ls author
       ls globbing_expression
	 The first form lists all distribution files in and below an author's
	 CPAN directory as they are stored in the CHECKUMS files distributed
	 on CPAN. The listing goes recursive into all subdirectories.

	 The second form allows to limit or expand the output with shell glob‐
	 bing as in the following examples:

		   ls JV/make*
		   ls GSAR/*make*
		   ls */*make*

	 The last example is very slow and outputs extra progress indicators
	 that break the alignment of the result.

	 Note that globbing only lists directories explicitly asked for, for
	 example FOO/* will not list FOO/bar/Acme-Sthg-n.nn.tar.gz. This may
	 be regarded as a bug and may be changed in future versions.

	 The "failed" command reports all distributions that failed on one of
	 "make", "test" or "install" for some reason in the currently running
	 shell session.

	 Interactive sessions maintain a lockfile, per default "~/.cpan/.lock"
	 (but the directory can be configured via the "cpan_home" config vari‐
	 able). The shell is a bit picky if you try to start another CPAN ses‐
	 sion. It dies immediately if there is a lockfile and the lock seems
	 to belong to a running process. In case you want to run a second
	 shell session, it is probably safest to maintain another directory,
	 say "~/.cpan-for-X/" and a "~/.cpan-for-X/CPAN/" that con‐
	 tains the configuration options. Then you can start the second shell

	   perl -I ~/.cpan-for-X -MCPAN::MyConfig -MCPAN -e shell

       Signals installs signal handlers for SIGINT and SIGTERM. While you
	 are in the cpan-shell it is intended that you can press "^C" anytime
	 and return to the cpan-shell prompt. A SIGTERM will cause the cpan-
	 shell to clean up and leave the shell loop. You can emulate the
	 effect of a SIGTERM by sending two consecutive SIGINTs, which usually
	 means by pressing "^C" twice. ignores a SIGPIPE. If the user sets inactivity_timeout, a
	 SIGALRM is used during the run of the "perl Makefile.PL" or "perl
	 Build.PL" subprocess.


       The commands that are available in the shell interface are methods in
       the package CPAN::Shell. If you enter the shell command, all your input
       is split by the Text::ParseWords::shellwords() routine which acts like
       most shells do. The first word is being interpreted as the method to be
       called and the rest of the words are treated as arguments to this
       method. Continuation lines are supported if a line ends with a literal


       "autobundle" writes a bundle file into the "$CPAN::Con‐
       fig->{cpan_home}/Bundle" directory. The file contains a list of all
       modules that are both available from CPAN and currently installed
       within @INC. The name of the bundle file is based on the current date
       and a counter.


       recompile() is a very special command in that it takes no argument and
       runs the make/test/install cycle with brute force over all installed
       dynamically loadable extensions (aka XS modules) with 'force' in
       effect. The primary purpose of this command is to finish a network
       installation. Imagine, you have a common source tree for two different
       architectures. You decide to do a completely independent fresh instal‐
       lation. You start on one architecture with the help of a Bundle file
       produced earlier. CPAN installs the whole Bundle for you, but when you
       try to repeat the job on the second architecture, CPAN responds with a
       "Foo up to date" message for all modules. So you invoke CPAN's recom‐
       pile on the second architecture and you're done.

       Another popular use for "recompile" is to act as a rescue in case your
       perl breaks binary compatibility. If one of the modules that CPAN uses
       is in turn depending on binary compatibility (so you cannot run CPAN
       commands), then you should try the CPAN::Nox module for recovery.


       mkmyconfig() writes your own CPAN::MyConfig file into your ~/.cpan/
       directory so that you can save your own preferences instead of the sys‐
       tem wide ones.

       The four "CPAN::*" Classes: Author, Bundle, Module, Distribution

       Although it may be considered internal, the class hierarchy does matter
       for both users and programmer. deals with above mentioned four
       classes, and all those classes share a set of methods. A classical sin‐
       gle polymorphism is in effect. A metaclass object registers all objects
       of all kinds and indexes them with a string. The strings referencing
       objects have a separated namespace (well, not completely separated):

		Namespace			  Class

	  words containing a "/" (slash)      Distribution
	   words starting with Bundle::		 Bundle
		 everything else	    Module or Author

       Modules know their associated Distribution objects. They always refer
       to the most recent official release. Developers may mark their releases
       as unstable development versions (by inserting an underbar into the
       module version number which will also be reflected in the distribution
       name when you run 'make dist'), so the really hottest and newest dis‐
       tribution is not always the default.  If a module Foo circulates on
       CPAN in both version 1.23 and 1.23_90, offers a convenient way
       to install version 1.23 by saying

	   install Foo

       This would install the complete distribution file (say
       BAR/Foo-1.23.tar.gz) with all accompanying material. But if you would
       like to install version 1.23_90, you need to know where the distribu‐
       tion file resides on CPAN relative to the authors/id/ directory. If the
       author is BAR, this might be BAR/Foo-1.23_90.tar.gz; so you would have
       to say

	   install BAR/Foo-1.23_90.tar.gz

       The first example will be driven by an object of the class CPAN::Mod‐
       ule, the second by an object of class CPAN::Distribution.

       Programmer's interface

       If you do not enter the shell, the available shell commands are both
       available as methods ("CPAN::Shell->install(...)") and as functions in
       the calling package ("install(...)").

       There's currently only one class that has a stable interface -
       CPAN::Shell. All commands that are available in the CPAN shell are
       methods of the class CPAN::Shell. Each of the commands that produce
       listings of modules ("r", "autobundle", "u") also return a list of the
       IDs of all modules within the list.

	 The IDs of all objects available within a program are strings that
	 can be expanded to the corresponding real objects with the
	 "CPAN::Shell->expand("Module",@things)" method. Expand returns a list
	 of CPAN::Module objects according to the @things arguments given. In
	 scalar context it only returns the first element of the list.

	 Like expand, but returns objects of the appropriate type, i.e.
	 CPAN::Bundle objects for bundles, CPAN::Module objects for modules
	 and CPAN::Distribution objects for distributions. Note: it does not
	 expand to CPAN::Author objects.

       Programming Examples
	 This enables the programmer to do operations that combine functional‐
	 ities that are available in the shell.

	     # install everything that is outdated on my disk:
	     perl -MCPAN -e 'CPAN::Shell->install(CPAN::Shell->r)'

	     # install my favorite programs if necessary:
	     for $mod (qw(Net::FTP Digest::SHA Data::Dumper)){
		 my $obj = CPAN::Shell->expand('Module',$mod);

	     # list all modules on my disk that have no VERSION number
	     for $mod (CPAN::Shell->expand("Module","/./")){
		 next unless $mod->inst_file;
		 # MakeMaker convention for undefined $VERSION:
		 next unless $mod->inst_version eq "undef";
		 print "No VERSION in ", $mod->id, "\n";

	     # find out which distribution on CPAN contains a module:
	     print CPAN::Shell->expand("Module","Apache::Constants")->cpan_file

	 Or if you want to write a cronjob to watch The CPAN, you could list
	 all modules that need updating. First a quick and dirty way:

	     perl -e 'use CPAN; CPAN::Shell->r;'

	 If you don't want to get any output in the case that all modules are
	 up to date, you can parse the output of above command for the regular
	 expression //modules are up to date// and decide to mail the output
	 only if it doesn't match. Ick?

	 If you prefer to do it more in a programmer style in one single
	 process, maybe something like this suits you better:

	   # list all modules on my disk that have newer versions on CPAN
	   for $mod (CPAN::Shell->expand("Module","/./")){
	     next unless $mod->inst_file;
	     next if $mod->uptodate;
	     printf "Module %s is installed as %s, could be updated to %s from CPAN\n",
		 $mod->id, $mod->inst_version, $mod->cpan_version;

	 If that gives you too much output every day, you maybe only want to
	 watch for three modules. You can write

	   for $mod (CPAN::Shell->expand("Module","/Apache⎪LWP⎪CGI/")){

	 as the first line instead. Or you can combine some of the above

	   # watch only for a new mod_perl module
	   $mod = CPAN::Shell->expand("Module","mod_perl");
	   exit if $mod->uptodate;
	   # new mod_perl arrived, let me know all update recommendations

       Methods in the other Classes

       The programming interface for the classes CPAN::Module, CPAN::Distribu‐
       tion, CPAN::Bundle, and CPAN::Author is still considered beta and par‐
       tially even alpha. In the following paragraphs only those methods are
       documented that have proven useful over a longer time and thus are
       unlikely to change.

	   Returns a one-line description of the author

	   Returns a multi-line description of the author

	   Returns the author's email address

	   Returns the author's name

	   An alias for fullname

	   Returns a one-line description of the bundle

	   Returns a multi-line description of the bundle

	   Recursively runs the "clean" method on all items contained in the

	   Returns a list of objects' IDs contained in a bundle. The associ‐
	   ated objects may be bundles, modules or distributions.

	   Forces CPAN to perform a task that normally would have failed.
	   Force takes as arguments a method name to be called and any number
	   of additional arguments that should be passed to the called method.
	   The internals of the object get the needed changes so that
	   does not refuse to take the action. The "force" is passed recur‐
	   sively to all contained objects.

	   Recursively runs the "get" method on all items contained in the

	   Returns the highest installed version of the bundle in either @INC
	   or "$CPAN::Config-"{cpan_home}>. Note that this is different from

	   Like CPAN::Bundle::inst_file, but returns the $VERSION

	   Returns 1 if the bundle itself and all its members are uptodate.

	   Recursively runs the "install" method on all items contained in the

	   Recursively runs the "make" method on all items contained in the

	   Recursively runs the "readme" method on all items contained in the

	   Recursively runs the "test" method on all items contained in the

	   Returns a one-line description of the distribution

	   Returns a multi-line description of the distribution

	   Returns the CPAN::Author object of the maintainer who uploaded this

	   Changes to the directory where the distribution has been unpacked
	   and runs "make clean" there.

	   Returns a list of IDs of modules contained in a distribution file.
	   Only works for distributions listed in the 02pack‐
	   ages.details.txt.gz file. This typically means that only the most
	   recent version of a distribution is covered.

	   Changes to the directory where the distribution has been unpacked
	   and runs something like

	       cvs -d $cvs_root import -m $cvs_log $cvs_dir $userid v$version


	   Returns the directory into which this distribution has been

	   Forces CPAN to perform a task that normally would have failed.
	   Force takes as arguments a method name to be called and any number
	   of additional arguments that should be passed to the called method.
	   The internals of the object get the needed changes so that
	   does not refuse to take the action.

	   Downloads the distribution from CPAN and unpacks it. Does nothing
	   if the distribution has already been downloaded and unpacked within
	   the current session.

	   Changes to the directory where the distribution has been unpacked
	   and runs the external command "make install" there. If "make" has
	   not yet been run, it will be run first. A "make test" will be
	   issued in any case and if this fails, the install will be canceled.
	   The cancellation can be avoided by letting "force" run the
	   "install" for you.

	   Returns 1 if this distribution file seems to be a perl distribu‐
	   tion.  Normally this is derived from the file name only, but the
	   index from CPAN can contain a hint to achieve a return value of
	   true for other filenames too.

	   Changes to the directory where the distribution has been unpacked
	   and opens a subshell there. Exiting the subshell returns.

	   First runs the "get" method to make sure the distribution is down‐
	   loaded and unpacked. Changes to the directory where the distribu‐
	   tion has been unpacked and runs the external commands "perl Make‐
	   file.PL" or "perl Build.PL" and "make" there.

	   Downloads the pod documentation of the file associated with a dis‐
	   tribution (in html format) and runs it through the external command
	   lynx specified in "$CPAN::Config-"{lynx}>. If lynx isn't available,
	   it converts it to plain text with external command html2text and
	   runs it through the pager specified in "$CPAN::Config-"{pager}>

	   Returns the hash reference that has been announced by a distribu‐
	   tion as the merge of the "requires" element and the
	   "build_requires" element of the META.yml or the "PREREQ_PM" hash in
	   the "Makefile.PL". Note: works only after an attempt has been made
	   to "make" the distribution. Returns undef otherwise.

	   Downloads the README file associated with a distribution and runs
	   it through the pager specified in "$CPAN::Config-"{pager}>.

	   Returns the content of the META.yml of this distro as a hashref.
	   Note: works only after an attempt has been made to "make" the dis‐
	   tribution.  Returns undef otherwise.

	   Changes to the directory where the distribution has been unpacked
	   and runs "make test" there.

	   Returns 1 if all the modules contained in the distribution are
	   uptodate. Relies on containsmods.

	   Forces a reload of all indices.

	   Reloads all indices if they have not been read for more than
	   "$CPAN::Config-"{index_expire}> days.

	   CPAN::Author, CPAN::Bundle, CPAN::Module, and CPAN::Distribution
	   inherit this method. It prints the data structure associated with
	   an object. Useful for debugging. Note: the data structure is con‐
	   sidered internal and thus subject to change without notice.

	   Returns a one-line description of the module

	   Returns a multi-line description of the module

	   Runs a clean on the distribution associated with this module.

	   Returns the filename on CPAN that is associated with the module.

	   Returns the latest version of this module available on CPAN.

	   Runs a cvs_import on the distribution associated with this module.

	   Returns a 44 character description of this module. Only available
	   for modules listed in The Module List (CPAN/modules/00mod‐
	   list.long.html or 00modlist.long.txt.gz)

	   Returns the CPAN::Distribution object that contains the current
	   version of this module.

	   Returns a hash reference. The keys of the hash are the letters "D",
	   "S", "L", "I", and <P>, for development status, support level, lan‐
	   guage, interface and public licence respectively. The data for the
	   DSLIP status are collected by when authors register
	   their namespaces. The values of the 5 hash elements are one-charac‐
	   ter words whose meaning is described in the table below. There are
	   also 5 hash elements "DV", "SV", "LV", "IV", and <PV> that carry a
	   more verbose value of the 5 status variables.

	   Where the 'DSLIP' characters have the following meanings:

	     D - Development Stage  (Note: *NO IMPLIED TIMESCALES*):
	       i   - Idea, listed to gain consensus or as a placeholder
	       c   - under construction but pre-alpha (not yet released)
	       a/b - Alpha/Beta testing
	       R   - Released
	       M   - Mature (no rigorous definition)
	       S   - Standard, supplied with Perl 5

	     S - Support Level:
	       m   - Mailing-list
	       d   - Developer
	       u   - Usenet newsgroup comp.lang.perl.modules
	       n   - None known, try comp.lang.perl.modules
	       a   - abandoned; volunteers welcome to take over maintainance

	     L - Language Used:
	       p   - Perl-only, no compiler needed, should be platform independent
	       c   - C and perl, a C compiler will be needed
	       h   - Hybrid, written in perl with optional C code, no compiler needed
	       +   - C++ and perl, a C++ compiler will be needed
	       o   - perl and another language other than C or C++

	     I - Interface Style
	       f   - plain Functions, no references used
	       h   - hybrid, object and function interfaces available
	       n   - no interface at all (huh?)
	       r   - some use of unblessed References or ties
	       O   - Object oriented using blessed references and/or inheritance

	     P - Public License
	       p   - Standard-Perl: user may choose between GPL and Artistic
	       g   - GPL: GNU General Public License
	       l   - LGPL: "GNU Lesser General Public License" (previously known as
		     "GNU Library General Public License")
	       b   - BSD: The BSD License
	       a   - Artistic license alone
	       o   - open source: appoved by
	       d   - allows distribution without restrictions
	       r   - restricted distribtion
	       n   - no license at all

	   Forces CPAN to perform a task that normally would have failed.
	   Force takes as arguments a method name to be called and any number
	   of additional arguments that should be passed to the called method.
	   The internals of the object get the needed changes so that
	   does not refuse to take the action.

	   Runs a get on the distribution associated with this module.

	   Returns the filename of the module found in @INC. The first file
	   found is reported just like perl itself stops searching @INC when
	   it finds a module.

	   Returns the version number of the module in readable format.

	   Runs an "install" on the distribution associated with this module.

	   Changes to the directory where the distribution associated with
	   this module has been unpacked and opens a subshell there. Exiting
	   the subshell returns.

	   Runs a "make" on the distribution associated with this module.

	   If module is installed, peeks into the module's manpage, reads the
	   headline and returns it. Moreover, if the module has been down‐
	   loaded within this session, does the equivalent on the downloaded
	   module even if it is not installed.

	   Runs a "perldoc" on this module.

	   Runs a "readme" on the distribution associated with this module.

	   Runs a "test" on the distribution associated with this module.

	   Returns 1 if the module is installed and up-to-date.

	   Returns the author's ID of the module.

       Cache Manager

       Currently the cache manager only keeps track of the build directory
       ($CPAN::Config->{build_dir}). It is a simple FIFO mechanism that
       deletes complete directories below "build_dir" as soon as the size of
       all directories there gets bigger than $CPAN::Config->{build_cache} (in
       MB). The contents of this cache may be used for later re-installations
       that you intend to do manually, but will never be trusted by CPAN
       itself. This is due to the fact that the user might use these directo‐
       ries for building modules on different architectures.

       There is another directory ($CPAN::Config->{keep_source_where}) where
       the original distribution files are kept. This directory is not covered
       by the cache manager and must be controlled by the user. If you choose
       to have the same directory as build_dir and as keep_source_where direc‐
       tory, then your sources will be deleted with the same fifo mechanism.


       A bundle is just a perl module in the namespace Bundle:: that does not
       define any functions or methods. It usually only contains documenta‐

       It starts like a perl module with a package declaration and a $VERSION
       variable. After that the pod section looks like any other pod with the
       only difference being that one special pod section exists starting with

	       =head1 CONTENTS

       In this pod section each line obeys the format

	       Module_Name [Version_String] [- optional text]

       The only required part is the first field, the name of a module (e.g.
       Foo::Bar, ie. not the name of the distribution file). The rest of the
       line is optional. The comment part is delimited by a dash just as in
       the man page header.

       The distribution of a bundle should follow the same convention as other

       Bundles are treated specially in the CPAN package. If you say 'install
       Bundle::Tkkit' (assuming such a bundle exists), CPAN will install all
       the modules in the CONTENTS section of the pod. You can install your
       own Bundles locally by placing a conformant Bundle file somewhere into
       your @INC path. The autobundle() command which is available in the
       shell interface does that for you by including all currently installed
       modules in a snapshot bundle file.


       If you have a local mirror of CPAN and can access all files with
       "file:" URLs, then you only need a perl better than perl5.003 to run
       this module. Otherwise Net::FTP is strongly recommended. LWP may be
       required for non-UNIX systems or if your nearest CPAN site is associ‐
       ated with a URL that is not "ftp:".

       If you have neither Net::FTP nor LWP, there is a fallback mechanism
       implemented for an external ftp command or for an external lynx com‐

       Finding packages and VERSION

       This module presumes that all packages on CPAN

       · declare their $VERSION variable in an easy to parse manner. This pre‐
	 requisite can hardly be relaxed because it consumes far too much mem‐
	 ory to load all packages into the running program just to determine
	 the $VERSION variable. Currently all programs that are dealing with
	 version use something like this

	     perl -MExtUtils::MakeMaker -le \
		 'print MM->parse_version(shift)' filename

	 If you are author of a package and wonder if your $VERSION can be
	 parsed, please try the above method.

       · come as compressed or gzipped tarfiles or as zip files and contain a
	 "Makefile.PL" or "Build.PL" (well, we try to handle a bit more, but
	 without much enthusiasm).


       The debugging of this module is a bit complex, because we have inter‐
       ferences of the software producing the indices on CPAN, of the mirror‐
       ing process on CPAN, of packaging, of configuration, of synchronicity,
       and of bugs within

       For code debugging in interactive mode you can try "o debug" which will
       list options for debugging the various parts of the code. You should
       know that "o debug" has built-in completion support.

       For data debugging there is the "dump" command which takes the same
       arguments as make/test/install and outputs the object's Data::Dumper

       Floppy, Zip, Offline Mode works nicely without network too. If you maintain machines that
       are not networked at all, you should consider working with file: URLs.
       Of course, you have to collect your modules somewhere first. So you
       might use to put together all you need on a networked machine.
       Then copy the $CPAN::Config->{keep_source_where} (but not $CPAN::Con‐
       fig->{build_dir}) directory on a floppy. This floppy is kind of a per‐
       sonal CPAN. on the non-networked machines works nicely with
       this floppy. See also below the paragraph about CD-ROM support.

       When the CPAN module is used for the first time, a configuration dialog
       tries to determine a couple of site specific options. The result of the
       dialog is stored in a hash reference  $CPAN::Config in a file CPAN/Con‐

       The default values defined in the CPAN/ file can be overridden
       in a user specific file: CPAN/ Such a file is best placed
       in $HOME/.cpan/CPAN/, because $HOME/.cpan is added to the
       search path of the CPAN module before the use() or require() state‐

       The configuration dialog can be started any time later again by issuing
       the command " o conf init " in the CPAN shell.

       Currently the following keys in the hash reference $CPAN::Config are

	 build_cache	    size of cache for directories to build modules
	 build_dir	    locally accessible directory to build modules
	 cache_metadata	    use serializer to cache metadata
	 cpan_home	    local directory reserved for this package
	 dontload_list	    arrayref: modules in the list will not be
			    loaded by the CPAN::has_inst() routine
	 getcwd		    see below
	 gzip		    location of external program gzip
	 histfile	    file to maintain history between sessions
	 histsize	    maximum number of lines to keep in histfile
	 inactivity_timeout breaks interactive Makefile.PLs or Build.PLs
			    after this many seconds inactivity. Set to 0 to
			    never break.
	 index_expire	    after this many days refetch index files
			    if true, does not print the startup message
	 keep_source_where  directory in which to keep the source (if we do)
	 make		    location of external make program
	 make_arg	    arguments that should always be passed to 'make'
			    the make command for running 'make install', for
			    example 'sudo make'
	 make_install_arg   same as make_arg for 'make install'
	 makepl_arg	    arguments passed to 'perl Makefile.PL'
	 mbuild_arg	    arguments passed to './Build'
	 mbuild_install_arg arguments passed to './Build install'
			    command to use instead of './Build' when we are
			    in the install stage, for example 'sudo ./Build'
	 mbuildpl_arg	    arguments passed to 'perl Build.PL'
	 pager		    location of external program more (or any pager)
	 prefer_installer   legal values are MB and EUMM: if a module comes
			    with both a Makefile.PL and a Build.PL, use the
			    former (EUMM) or the latter (MB); if the module
			    comes with only one of the two, that one will be
			    used in any case
			    what to do if you are missing module prerequisites
			    ('follow' automatically, 'ask' me, or 'ignore')
	 proxy_user	    username for accessing an authenticating proxy
	 proxy_pass	    password for accessing an authenticating proxy
	 scan_cache	    controls scanning of cache ('atstart' or 'never')
	 tar		    location of external program tar
	 term_is_latin	    if true internal UTF-8 is translated to ISO-8859-1
			    (and nonsense for characters outside latin range)
	 unzip		    location of external program unzip
	 urllist	    arrayref to nearby CPAN sites (or equivalent locations)
	 wait_list	    arrayref to a wait server to try (See CPAN::WAIT)
	 ftp_passive	    if set, the envariable FTP_PASSIVE is set for downloads
	 ftp_proxy,	 }  the three usual variables for configuring
	   http_proxy,	 }  proxy requests. Both as CPAN::Config variables
	   no_proxy	 }  and as environment variables configurable.

       You can set and query each of these options interactively in the cpan
       shell with the command set defined within the "o conf" command:

       "o conf <scalar option>"
	 prints the current value of the scalar option

       "o conf <scalar option> <value>"
	 Sets the value of the scalar option to value

       "o conf <list option>"
	 prints the current value of the list option in MakeMaker's neatvalue

       "o conf <list option> [shift⎪pop]"
	 shifts or pops the array in the list option variable

       "o conf <list option> [unshift⎪push⎪splice] <list>"
	 works like the corresponding perl commands.

       Not on config variable getcwd changes the current working directory often and needs to deter‐
       mine its own current working directory. Per default it uses Cwd::cwd
       but if this doesn't work on your system for some reason, alternatives
       can be configured according to the following table:

	   cwd	       Cwd::cwd
	   getcwd      Cwd::getcwd
	   fastcwd     Cwd::fastcwd
	   backtickcwd external command cwd

       Note on urllist parameter's format

       urllist parameters are URLs according to RFC 1738. We do a little
       guessing if your URL is not compliant, but if you have problems with
       file URLs, please try the correct format. Either:




       urllist parameter has CD-ROM support

       The "urllist" parameter of the configuration table contains a list of
       URLs that are to be used for downloading. If the list contains any
       "file" URLs, CPAN always tries to get files from there first. This fea‐
       ture is disabled for index files. So the recommendation for the owner
       of a CD-ROM with CPAN contents is: include your local, possibly out‐
       dated CD-ROM as a "file" URL at the end of urllist, e.g.

	 o conf urllist push file://localhost/CDROM/CPAN will then fetch the index files from one of the CPAN sites that
       come at the beginning of urllist. It will later check for each module
       if there is a local copy of the most recent version.

       Another peculiarity of urllist is that the site that we could success‐
       fully fetch the last file from automatically gets a preference token
       and is tried as the first site for the next request. So if you add a
       new site at runtime it may happen that the previously preferred site
       will be tried another time. This means that if you want to disallow a
       site for the next transfer, it must be explicitly removed from urllist.

       There's no strong security layer in helps you to
       install foreign, unmasked, unsigned code on your machine. We compare to
       a checksum that comes from the net just as the distribution file
       itself. But we try to make it easy to add security on demand:

       Cryptographically signed modules

       Since release 1.77 has been able to verify cryptographically
       signed module distributions using Module::Signature.  The CPAN modules
       can be signed by their authors, thus giving more security.  The simple
       unsigned MD5 checksums that were used before by CPAN protect mainly
       against accidental file corruption.

       You will need to have Module::Signature installed, which in turn
       requires that you have at least one of Crypt::OpenPGP module or the
       command-line gpg tool installed.

       You will also need to be able to connect over the Internet to the pub‐
       lic keyservers, like, and their port 11731 (the HKP proto‐

       Most functions in package CPAN are exported per default. The reason for
       this is that the primary use is intended for the cpan shell or for

       When the CPAN shell enters a subshell via the look command, it sets the
       environment CPAN_SHELL_LEVEL to 1 or increments it if it is already

       When the config variable ftp_passive is set, all downloads will be run
       with the environment variable FTP_PASSIVE set to this value. This is in
       general a good idea as it influences both Net::FTP and LWP based con‐
       nections. The same effect can be achieved by starting the cpan shell
       with this environment variable set. For Net::FTP alone, one can also
       always set passive mode by running libnetcfg.

       Populating a freshly installed perl with my favorite modules is pretty
       easy if you maintain a private bundle definition file. To get a useful
       blueprint of a bundle definition file, the command autobundle can be
       used on the CPAN shell command line. This command writes a bundle defi‐
       nition file for all modules that are installed for the currently run‐
       ning perl interpreter. It's recommended to run this command only once
       and from then on maintain the file manually under a private name, say
       Bundle/ With a clever bundle file you can then simply say

	   cpan> install Bundle::my_bundle

       then answer a few questions and then go out for a coffee.

       Maintaining a bundle definition file means keeping track of two things:
       dependencies and interactivity. sometimes fails on calculating
       dependencies because not all modules define all MakeMaker attributes
       correctly, so a bundle definition file should specify prerequisites as
       early as possible. On the other hand, it's a bit annoying that many
       distributions need some interactive configuring. So what I try to
       accomplish in my private bundle file is to have the packages that need
       to be configured early in the file and the gentle ones later, so I can
       go out after a few minutes and leave untended.

       Thanks to Graham Barr for contributing the following paragraphs about
       the interaction between perl, and various firewall configurations. For
       further information on firewalls, it is recommended to consult the doc‐
       umentation that comes with the ncftp program. If you are unable to go
       through the firewall with a simple Perl setup, it is very likely that
       you can configure ncftp so that it works for your firewall.

       Three basic types of firewalls

       Firewalls can be categorized into three basic types.

       http firewall
	   This is where the firewall machine runs a web server and to access
	   the outside world you must do it via the web server. If you set
	   environment variables like http_proxy or ftp_proxy to a values
	   beginning with http:// or in your web browser you have to set proxy
	   information then you know you are running an http firewall.

	   To access servers outside these types of firewalls with perl (even
	   for ftp) you will need to use LWP.

       ftp firewall
	   This where the firewall machine runs an ftp server. This kind of
	   firewall will only let you access ftp servers outside the firewall.
	   This is usually done by connecting to the firewall with ftp, then
	   entering a username like ""

	   To access servers outside these type of firewalls with perl you
	   will need to use Net::FTP.

       One way visibility
	   I say one way visibility as these firewalls try to make themselves
	   look invisible to the users inside the firewall. An FTP data con‐
	   nection is normally created by sending the remote server your IP
	   address and then listening for the connection. But the remote
	   server will not be able to connect to you because of the firewall.
	   So for these types of firewall FTP connections need to be done in a
	   passive mode.

	   There are two that I can think off.

	       If you are using a SOCKS firewall you will need to compile perl
	       and link it with the SOCKS library, this is what is normally
	       called a 'socksified' perl. With this executable you will be
	       able to connect to servers outside the firewall as if it is not

	   IP Masquerade
	       This is the firewall implemented in the Linux kernel, it allows
	       you to hide a complete network behind one IP address. With this
	       firewall no special compiling is needed as you can access hosts

	       For accessing ftp servers behind such firewalls you usually
	       need to set the environment variable "FTP_PASSIVE" or the con‐
	       fig variable ftp_passive to a true value.

       Configuring lynx or ncftp for going through a firewall

       If you can go through your firewall with e.g. lynx, presumably with a
       command such as

	   /usr/local/bin/lynx -pscott:tiger

       then you would configure with the command

	   o conf lynx "/usr/local/bin/lynx -pscott:tiger"

       That's all. Similarly for ncftp or ftp, you would configure something

	   o conf ncftp "/usr/bin/ncftp -f /home/scott/ncftplogin.cfg"

       Your mileage may vary...

       1)  I installed a new version of module X but CPAN keeps saying, I have
	   the old version installed

	   Most probably you do have the old version installed. This can hap‐
	   pen if a module installs itself into a different directory in the
	   @INC path than it was previously installed. This is not really a problem, you would have the same problem when installing
	   the module manually. The easiest way to prevent this behaviour is
	   to add the argument "UNINST=1" to the "make install" call, and that
	   is why many people add this argument permanently by configuring

	     o conf make_install_arg UNINST=1

       2)  So why is UNINST=1 not the default?

	   Because there are people who have their precise expectations about
	   who may install where in the @INC path and who uses which @INC
	   array. In fine tuned environments "UNINST=1" can cause damage.

       3)  I want to clean up my mess, and install a new perl along with all
	   modules I have. How do I go about it?

	   Run the autobundle command for your old perl and optionally rename
	   the resulting bundle file (e.g. Bundle/, install the
	   new perl with the Configure option prefix, e.g.

	       ./Configure -Dprefix=/usr/local/perl-

	   Install the bundle file you produced in the first step with some‐
	   thing like

	       cpan> install Bundle::mybundle

	   and you're done.

       4)  When I install bundles or multiple modules with one command there
	   is too much output to keep track of.

	   You may want to configure something like

	     o conf make_arg "⎪ tee -ai /root/.cpan/logs/make.out"
	     o conf make_install_arg "⎪ tee -ai /root/.cpan/logs/make_install.out"

	   so that STDOUT is captured in a file for later inspection.

       5)  I am not root, how can I install a module in a personal directory?

	   First of all, you will want to use your own configuration, not the
	   one that your root user installed. If you do not have permission to
	   write in the cpan directory that root has configured, you will be
	   asked if you want to create your own config. Answering "yes" will
	   bring you into CPAN's configuration stage, using the system config
	   for all defaults except things that have to do with CPAN's work
	   directory, saving your choices to your file.

	   You can also manually initiate this process with the following com‐

	       % perl -MCPAN -e 'mkmyconfig'

	   or by running


	   from the CPAN shell.

	   You will most probably also want to configure something like this:

	     o conf makepl_arg "LIB=~/myperl/lib \
			       INSTALLMAN1DIR=~/myperl/man/man1 \

	   You can make this setting permanent like all "o conf" settings with
	   "o conf commit".

	   You will have to add ~/myperl/man to the MANPATH environment vari‐
	   able and also tell your perl programs to look into ~/myperl/lib,
	   e.g. by including

	     use lib "$ENV{HOME}/myperl/lib";

	   or setting the PERL5LIB environment variable.

	   While we're speaking about $ENV{HOME}, it might be worth mention‐
	   ing, that for Windows we use the File::HomeDir module that provides
	   an equivalent to the concept of the home directory on Unix.

	   Another thing you should bear in mind is that the UNINST parameter
	   can be dnagerous when you are installing into a private area
	   because you might accidentally remove modules that other people
	   depend on that are not using the private area.

       6)  How to get a package, unwrap it, and make a change before building

	     look Sybase::Sybperl

       7)  I installed a Bundle and had a couple of fails. When I retried,
	   everything resolved nicely. Can this be fixed to work on first try?

	   The reason for this is that CPAN does not know the dependencies of
	   all modules when it starts out. To decide about the additional
	   items to install, it just uses data found in the META.yml file or
	   the generated Makefile. An undetected missing piece breaks the
	   process. But it may well be that your Bundle installs some prereq‐
	   uisite later than some depending item and thus your second try is
	   able to resolve everything.	Please note, does not know the
	   dependency tree in advance and cannot sort the queue of things to
	   install in a topologically correct order. It resolves perfectly
	   well IF all modules declare the prerequisites correctly with the
	   PREREQ_PM attribute to MakeMaker or the "requires" stanza of Mod‐
	   ule::Build. For bundles which fail and you need to install often,
	   it is recommended to sort the Bundle definition file manually.

       8)  In our intranet we have many modules for internal use. How can I
	   integrate these modules with but without uploading the mod‐
	   ules to CPAN?

	   Have a look at the CPAN::Site module.

       9)  When I run CPAN's shell, I get an error message about things in my
	   /etc/inputrc (or ~/.inputrc) file.

	   These are readline issues and can only be fixed by studying read‐
	   line configuration on your architecture and adjusting the refer‐
	   enced file accordingly. Please make a backup of the /etc/inputrc or
	   ~/.inputrc and edit them. Quite often harmless changes like upper‐
	   casing or lowercasing some arguments solves the problem.

       10) Some authors have strange characters in their names.

	   Internally uses the UTF-8 charset. If your terminal is
	   expecting ISO-8859-1 charset, a converter can be activated by set‐
	   ting term_is_latin to a true value in your config file. One way of
	   doing so would be

	       cpan> o conf term_is_latin 1

	   If other charset support is needed, please file a bugreport against at and describe your needs. Maybe we can extend
	   the support or maybe UTF-8 terminals become widely available.

       11) When an install fails for some reason and then I correct the error
	   condition and retry, refuses to install the module, saying
	   "Already tried without success".

	   Use the force pragma like so

	     force install Foo::Bar

	   This does a bit more than really needed because it untars the dis‐
	   tribution again and runs make and test and only then install.

	   Or, if you find this is too fast and you would prefer to do smaller
	   steps, say

	     force get Foo::Bar

	   first and then continue as always. "Force get" forgets previous
	   error conditions.

	   Or you can use

	     look Foo::Bar

	   and then 'make install' directly in the subshell.

	   Or you leave the CPAN shell and start it again.

	   For the really curious, by accessing internals directly, you could

	     !delete CPAN::Shell->expandany("Foo::Bar")->distribution->{install}

	   but this is neither guaranteed to work in the future nor is it a
	   decent command.

       12) How do I install a "DEVELOPER RELEASE" of a module?

	   By default, CPAN will install the latest non-developer release of a
	   module.  If you want to install a dev release, you have to specify
	   a partial path to the tarball you wish to install, like so:

	       cpan> install KWILLIAMS/Module-Build-0.27_07.tar.gz

       13) How do I install a module and all its dependencies from the comman‐
	   dline, without being prompted for anything, despite my CPAN config‐
	   uration (or lack thereof)?

	   CPAN uses ExtUtils::MakeMaker's prompt() function to ask its ques‐
	   tions, so if you set the PERL_MM_USE_DEFAULT environment variable,
	   you shouldn't be asked any questions at all (assuming the modules
	   you are installing are nice about obeying that variable as well):

	       % PERL_MM_USE_DEFAULT=1 perl -MCPAN -e 'install My::Module'

       14) I only know the usual options for ExtUtils::MakeMaker(Mod‐
	   ule::Build), how do I find out the corresponding options in Mod‐

       Please report bugs via

       Before submitting a bug, please make sure that the traditional method
       of building a Perl module package from a shell by following the instal‐
       lation instructions of that package still works in your environment.

       Andreas Koenig "<>"

       Kawai,Takanori provides a Japanese translation of this manpage at

       cpan(1), CPAN::Nox(3pm), CPAN::Version(3pm)

perl v5.8.8			  2006-02-27			       CPAN(3)
                             _         _         _ 
                            | |       | |       | |     
                            | |       | |       | |     
                         __ | | __ __ | | __ __ | | __  
                         \ \| |/ / \ \| |/ / \ \| |/ /  
                          \ \ / /   \ \ / /   \ \ / /   
                           \   /     \   /     \   /    
                            \_/       \_/       \_/ 
More information is available in HTML format for server UnixWare

List of man pages available for UnixWare

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
Vote for polarhome
Free Shell Accounts :: the biggest list on the net