CPANM(1p) | User Contributed Perl Documentation | CPANM(1p) |
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 ~/dists/MyCompany-Enterprise-1.00.tar.gz # install from a local file cpanm --interactive Task::Kensho # Configure interactively cpanm . # install from local directory cpanm --installdeps . # install all the deps for the current directory cpanm -L extlib Plack # install Plack and all non-core deps into extlib cpanm --mirror http://cpan.cpantesters.org/ DBI # use the fast-syncing mirror cpanm --from https://cpan.metacpan.org/ Plack # use only the HTTPS mirror
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/plack/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 cpanm Plack~">= 1.0000, < 2.0000" # latest of 1.xxxx cpanm Plack@0.9990 # specific version. same as Plack~"== 0.9990"
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.
For a git repository, you can specify a branch, tag, or commit SHA to build. The default is "master"
cpanm git://github.com/plack/Plack.git@1.0000 # tag cpanm git://github.com/plack/Plack.git@devel # branch
cpanm App::cpanminus
cpanm --installdeps .
You can specify the default options in "PERL_CPANM_OPT" environment variable.
Defaults to false, and you can say "--no-notest" to override when it is set in the default options in "PERL_CPANM_OPT".
Note that if you specify this option with a module or distribution that has dependencies, these dependencies will be installed if you don't currently have them.
Defaults to false, and you can say "--no-sudo" to override when it is set in the default options in "PERL_CPANM_OPT".
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:
use local::lib '/path/to/extlib';
Note that this option does NOT reliably work with perl installations supplied by operating system vendors that strips standard modules from perl, such as RHEL, Fedora and CentOS, UNLESS you also install packages supplying all the modules that have been stripped. For these systems you will probably want to install the "perl-core" meta-package which does just that.
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.
cpanm --mirror file:///path/to/mirror cpanm --mirror ~/minicpan # Because shell expands ~ to /home/user
Defaults to "http://www.cpan.org/".
Select this option if you are using a local mirror of CPAN, such as minicpan when you're offline, or your own CPAN index (a.k.a darkpan).
cpanm -M https://cpan.metacpan.org/ cpanm --from https://cpan.metacpan.org/
Use the given mirror URL and its index as the only source to search and download modules from.
It works similar to "--mirror" and "--mirror-only" combined, with a small difference: unlike "--mirror" which appends the URL to the list of mirrors, "--from" (or "-M" for short) uses the specified URL as its only source to download index and modules from. This makes the option always override the default mirror, which might have been set via global options such as the one set by "PERL_CPANM_OPT" environment variable.
Tip: It might be useful if you name these options with your shell aliases, like:
alias minicpanm='cpanm --from ~/minicpan' alias darkpan='cpanm --from http://mycompany.example.com/DPAN'
Defaults to false, and you can say "--no-prompt" to override if it's set in the default options in "PERL_CPANM_OPT".
cpanm --reinstall Plack
would reinstall Plack even if your locally installed version is latest, or even newer (which would happen if you install a developer release from version control repositories).
Defaults to false.
Defaults to false, and you can say "--no-interactive" to override when it's set in the default options in "PERL_CPANM_OPT".
Enabling this could potentially make a circular dependency for a few modules on CPAN, when "recommends" adds a module that "recommends" back the module in return.
There's also "--without-recommend" and "--without-suggests" to override the default decision made earlier in "PERL_CPANM_OPT".
Defaults to false for both.
cpanm --with-feature=opt_csv Spreadsheet::Read
the features can also be interactively chosen when "--interactive" option is enabled.
"--with-all-features" enables all the optional features, and "--without-feature" can select a feature to disable.
cpanm DBD::mysql --configure-args="--cflags=... --libs=..."
The argument is only enabled for the module passed as a command line argument, not dependencies.
Because this command doesn't actually install any distributions, it will be useful that by typing:
cpanm --scandeps Catalyst::Runtime
you can make sure what modules will be installed.
This command takes into account which modules you already have installed in your system. If you want to see what modules will be installed against a vanilla perl installation, you might want to combine it with "-L" option.
[ 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.
GAAS/MIME-Base64-3.13.tar.gz GAAS/URI-1.58.tar.gz PETDANCE/HTML-Tagset-3.20.tar.gz GAAS/HTML-Parser-3.68.tar.gz GAAS/libwww-perl-5.837.tar.gz
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 the distro tarball did not come from CPAN, for example from a local file or from GitHub, then it will be saved under vendor/Foo-Bar-version.tar.gz.
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: Since version 1.3000 this flag is turned off by default for perl newer than 5.12, since with 5.12 @INC contains site_perl directory before the perl core library path, and uninstalling shadows is not necessary anymore and does more harm by deleting files from the core library path.
If you enable local::lib, it only removes files from the local::lib directory.
If you try to uninstall a module in "perl" directory (i.e. core module), an error will be thrown.
A dialog will be prompted to confirm the files to be deleted. If you pass "-f" option as well, the dialog will be skipped and uninstallation will be forced.
NOTE: The "PERL5LIB" environment variable have to be correctly set for this to work with modules installed using local::lib, unless you always use the "-l" option.
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.
You can set the value to 0 to make cpan never cleanup those directories.
Defaults to true (man pages generated) unless "-L|--local-lib-contained" option is supplied in which case it's set to false. You can disable it with "--no-man-pages".
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.
App::cpanminus
Copyright 2010- Tatsuhiko Miyagawa.
Tatsuhiko Miyagawa
2020-07-04 | perl v5.30.3 |