Tatsuhiko Miyagawa > App-cpanminus-1.6101 > cpanm


Annotate this POD

View/Report Bugs
Source   Latest Release: App-cpanminus-1.7004


cpanm - get, unpack build and install modules from CPAN


  cpanm Test::More                                 # install Test::More
  cpanm MIYAGAWA/Plack-0.99_05.tar.gz              # full distribution path
  cpanm http://example.org/LDS/CGI.pm-3.20.tar.gz  # install from URL
  cpanm --interactive Task::Kensho                 # Configure interactively
  cpanm .                                          # install from local directory
  cpanm --mirror http://cpan.cpantesters.org/ DBI  # use the fast-syncing mirror
  cpanm --scandeps Moose                           # See what modules will be installed for Moose




    cpanm Plack
    cpanm Plack/Request.pm
    cpanm MIYAGAWA/Plack-1.0000.tar.gz
    cpanm /path/to/Plack-1.0000.tar.gz
    cpanm http://cpan.metacpan.org/authors/id/M/MI/MIYAGAWA/Plack-0.9990.tar.gz
    cpanm git://github.com/miyagawa/Plack.git

Additionally, you can use the notation using ~ and @ to specify version for a given module. ~ specifies the version requirement in the CPAN::Meta::Spec format, while @ pins the exact version, and is a shortcut for ~"== VERSION".

    cpanm Plack~1.0000                 # 1.0000 or later

The version query including specific version or range will be sent to MetaCPAN to search for previous releases. The query will search for BackPAN archives by default, unless you specify --dev option, in which case, archived versions will be filtered out.


    cpanm git://github.com/miyagawa/Plack.git@1.0000        # tag
    cpanm git://github.com/miyagawa/Plack.git@devel         # branch
-i, --install



Upgrades itself. It's just an alias for:

  cpanm App::cpanminus

Displays the distribution information in AUTHOR/Dist-Name-ver.tar.gz format in the standard out.



  cpanm --installdeps .


-h, --help

Displays the help message.

-V, --version

Displays the version number.


You can specify the default options in PERL_CPANM_OPT environment variable.

-f, --force

Force install modules even when testing failed.

-n, --notest


Defaults to false, and you can say --no-notest to override when it is set in the default options in PERL_CPANM_OPT.




-S, --sudo

Switch to the root user with sudo when installing modules. Use this if you want to install modules to the system perl include path.

Defaults to false, and you can say --no-sudo to override when it is set in the default options in PERL_CPANM_OPT.

-v, --verbose


-q, --quiet

Makes the output even more quiet than the default. It doesn't print anything to the STDERR.

-l, --local-lib


-L, --local-lib-contained

Same with --local-lib but when examining the dependencies, it assumes no non-core modules are installed on the system. It's handy if you want to bundle application dependencies in one directory so you can distribute to other machines.

For instance,

  cpanm -L extlib Plack

would install Plack and all of its non-core dependencies into the directory extlib, which can be loaded from your application with:


Specifies the base URL for the CPAN mirror to use, such as http://cpan.cpantesters.org/ (you can omit the trailing slash). You can specify multiple mirror URLs by repeating the command line option.

You can use a local directory that has a CPAN mirror structure (created by tools such as OrePAN or Pinto) by using a special URL scheme file://. If the given URL begins with `/` (without any scheme), it is considered as a file scheme as well.


Defaults to http://search.cpan.org/CPAN which is a geo location aware redirector.




Tip: It might be useful if you name these mirror options with your shell aliases, like:

  alias minicpanm='cpanm --mirror ~/minicpan --mirror-only'
  alias darkpan='cpanm --mirror http://mycompany.example.com/DPAN --mirror-only'

EXPERIMENTAL: Specifies the file path to 02packages.details.txt for module search index.



Defaults to false, and you can say --no-prompt to override if it's set in the default options in PERL_CPANM_OPT.




cpanm, when given a module name in the command line (i.e. cpanm Plack), checks the locally installed version first and skips if it is already installed. This option makes it skip the check, so:

  cpanm --reinstall Plack


Defaults to false.


Makes the configuration (such as Makefile.PL and Build.PL) interactive, so you can answer questions in the distribution that requires custom configuration or Task:: distributions.

Defaults to false, and you can say --no-interactive to override when it's set in the default options in PERL_CPANM_OPT.


Scans the depencencies of given modules and output the tree in a text format. (See --format below for more options)


  cpanm --scandeps Catalyst::Runtime

you can make sure what modules will be installed.



Determines what format to display the scanned dependency tree. Available options are tree, json, yaml and dists.



json, yaml


  [ distribution, dependencies ]

and the container is an array containing the root elements. Note that there may be multiple root nodes, since you can give multiple modules to the --scandeps command.




which means you can install these distributions in this order without extra dependencies. When combined with -L option, it will be useful to replay installations on other machines.






If you run cpanm as root and use INSTALL_BASE or equivalent to specify custom installation path, you SHOULD disable this option so you won't accidentally uninstall dual-life modules from the core include path.

Defaults to true if your perl version is smaller than 5.12, and you can disable that with --no-uninst-shadows.






NOTE: The PERL5LIB environment variable have to be correctly set for this to work with modules installed using local::lib.



If you run:

  cpanm --skip-satisfied CGI DBI~1.2

cpanm won't install them if you already have CGI (for whatever versions) or have DBI with version higher than 1.2. It is similar to --skip-installed but while --skip-installed checks if the latest version of CPAN is installed, --skip-satisfied checks if a requested version (or not, which means any version) is installed.

Defaults to false.




Whether it report the locally installed perl version to the various web server as part of User-Agent. Defaults to true, and you can disable it by using --no-report-perl-version.






Defaults to false (no man pages generated) if -L|--local-lib-contained option is supplied. Otherwise, defaults to true, and you can disable it with --no-man-pages.


Uses LWP module to download stuff over HTTP. Defaults to true, and you can say --no-lwp to disable using LWP, when you want to upgrade LWP from CPAN on some broken perl systems.


Uses GNU Wget (if available) to download stuff. Defaults to true, and you can say --no-wget to disable using Wget (versions of Wget older than 1.9 don't support the --retry-connrefused option used by cpanm).


Uses cURL (if available) to download stuff. Defaults to true, and you can say --no-curl to disable using cURL.

Normally with --lwp, --wget and --curl options set to true (which is the default) cpanm tries LWP, Wget, cURL and HTTP::Tiny (in that order) and uses the first one available.




Copyright 2010 Tatsuhiko Miyagawa.


Tatsuhiko Miyagawa

syntax highlighting: