App::cp...tscript(3)
β¨ NAME β¨
okay so this is the App::cp...tscript(3) page, and the main character is cpanm β the tool that gets, unpacks, builds, and installs modules from CPAN. bestie, it's giving "I can literally fetch a whole distribution and make it work" energy π
β¨
π SYNOPSIS π
like, here are the vibes in command form:
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
πΈ COMMANDS πΈ
π§ (arguments)
bestie, the command line arguments can be a module name, a distribution file, a local file path, an HTTP URL, or a git repository URL. the way that all of these just work as you expect? iconic.
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
also, you can use the ~ and @ notation to specify a version for a given module. ~ specifies the version requirement in the CPAN::Meta::Spec format, while @ pins the exact version, and it's 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 the --dev option, in which case, archived versions will be filtered out. no cap, that's the whole situation.
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
-i,--installβ installs the modules. this is a default behavior and this is just a compatibility option to make it work likecpanorcpanp. slay for backwards vibes π--self-upgradeβ upgrades itself. it's just an alias for:
cpanm App::cpanminus
--infoβ displays the distribution information inAUTHOR/Dist-Name-ver.tar.gzformat in the standard out. cute little info dump β¨--installdepsβ installs the dependencies of the target distribution but won't build itself. handy if you want to try the application from a version controlled repository such as git.
cpanm --installdeps .
--lookβ download and unpack the distribution and then open the directory with your shell. handy to poke around the source code or do manual testing. very "let me inspect the vibe" energy π-h,--helpβ displays the help message.-V,--versionβ displays the version number.
π OPTIONS π
you can specify the default options in the PERL_CPANM_OPT environment variable. periodt.
-f,--forceβ force install modules even when testing failed. dramatic? yes. useful? sometimes. π-n,--notestβ skip the testing of modules. use this only when you just want to save time for installing hundreds of distributions to the same perl and architecture you've already tested to make sure it builds fine.
defaults to false, and you can say --no-notest to override when it is set in the default options in PERL_CPANM_OPT.
--test-onlyβ run the tests only, and do not install the specified module or distributions. handy if you want to verify the new (or even old) releases pass its unit tests without installing the module.
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.
-S,--sudoβ switch to the root user withsudowhen 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β makes the output verbose. it also enables the interactive configuration. (see--interactive) lowkey turning up the volume on the whole build π-q,--quietβ makes the output even more quiet than the default. it only shows the successful/failed dependencies to the output. minimalist queen behavior π-l,--local-libβ sets thelocal::libcompatible path to install modules to. you don't need to set this if you already configure the shell environment variables usinglocal::lib, but this can be used to override that as well.-L,--local-lib-containedβ same with--local-libbut with--self-containedset. all non-core dependencies will be installed even if they're already installed.
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. bestie, read that twice, it's important π
--self-containedβ when examining the dependencies, assume no non-core modules are installed on the system. handy if you want to bundle application dependencies in one directory so you can distribute to other machines. it's giving "portable little ecosystem" π¦--exclude-vendorβ don't include modules installed under the'vendor'paths when searching for core modules when the--self-containedflag is in effect. this restores the behaviour from before version 1.7023.--mirrorβ specifies the base URL for the CPAN mirror to use, such ashttp://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.
cpanm --mirror file:///path/to/mirror
cpanm --mirror ~/minicpan # Because shell expands ~ to /home/user
defaults to http://www.cpan.org/.
--mirror-onlyβ download the mirror's02packages.details.txt.gzindex file instead of querying the CPAN Meta DB. this will also effectively opt out sending your local perl versions to backend database servers such as CPAN Meta DB and MetaCPAN.
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). privacy-ish and offline-friendly, we love that π
--from,-Mβ
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'
--mirror-indexβ EXPERIMENTAL: specifies the file path to02packages.details.txtfor module search index.--cpanmetadbβ EXPERIMENTAL: specifies an alternate URI for CPAN MetaDB index lookups.--metacpanβ prefers MetaCPAN API over CPAN MetaDB.--cpanfileβ EXPERIMENTAL: specified an alternate path for cpanfile to search for, when--installdepscommand is in use. defaults tocpanfile.--promptβ prompts when a test fails so that you can skip, force install, retry or look in the shell to see what's going wrong. it also prompts when one of the dependency failed if you want to proceed the installation.
defaults to false, and you can say --no-prompt to override if it's set in the default options in PERL_CPANM_OPT.
--devβ EXPERIMENTAL: search for a newer developer release as well. defaults to false.--reinstallβ 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
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.
--interactiveβ makes the configuration (such asMakefile.PLandBuild.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.
--pp,--pureperlβ prefer Pure perl build of modules by settingPUREPERL_ONLY=1for MakeMaker and--pureperl-onlyfor Build.PL based distributions. note that not all of the CPAN modules support this convention yet.--with-recommends,--with-suggestsβ EXPERIMENTAL: installs dependencies declared asrecommendsandsuggestsrespectively, per META spec. when these dependencies fail to install, cpanm continues the installation, since they're just recommendation/suggestion.
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. messy, but at least it's honest π
There's also --without-recommend and --without-suggests to override the default decision made earlier in PERL_CPANM_OPT.
Defaults to false for both, bestie β so no sneaky recommends/suggests unless you asked. π
--with-developβ EXPERIMENTAL β¨ Installs develop phase dependencies in META files orcpanfilewhen used with--installdeps. Defaults to false.--with-configureβ EXPERIMENTAL β¨ Installs configure phase dependencies incpanfilewhen used with--installdeps. Defaults to false.--with-feature,--without-feature,--with-all-featuresβ EXPERIMENTAL β¨ Says which feature to enable, if a module supports optional features per META spec 2.0. Like so:
cpanm --with-feature=opt_csv Spreadsheet::Read
The features can also be interactively chosen when the --interactive option is enabled, iykyk π
--with-all-features enables all the optional features, and --without-feature can select a feature to disable. Very "I want everything on the menu" of you. π
--configure-timeout,--build-timeout,--test-timeoutβ Specify the timeout length (in seconds) to wait for the configure, build and test process. Current default values are:60for configure,3600for build and1800for test. β° Lowkey generous, ngl.--configure-args,--build-args,--test-args,--install-argsβ EXPERIMENTAL β¨ Pass arguments for the configure/build/test/install commands respectively, for a given module to install:
cpanm DBD::mysql --configure-args="--cflags=... --libs=..."
Heads up bestie: the argument is only enabled for the module passed as a command line argument β not dependencies. No leaking your flags down the tree. π
--scandepsβ DEPRECATED π Scans the dependencies of given modules and outputs the tree in a text format. (See--formatbelow for more options.)
Because this command doesn't actually install any distributions, it's genuinely useful to type:
cpanm --scandeps Catalyst::Runtime
and then you can make sure what modules will be installed. Main character foresight. π
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 the -L option. π¦
--formatβ DEPRECATED π Determines what format to display the scanned dependency tree. Available options aretree,json,yamlanddists.treeβ Displays the tree in a plain text format. This is the default value. π³json,yamlβ Outputs the tree in a JSON or YAML format. JSON and YAML modules need to be installed respectively. The output tree is represented as a recursive tuple of:
[ 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. π
distsβdistsis a special output format, where it prints the distribution filename in the depth first order after the dependency resolution, like:
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 the -L option, it will be useful to replay installations on other machines. π§β¨
--save-distsβ Specifies the optional directory path to copy downloaded tarballs into, in the CPAN mirror compatible directory structure, i.e.
authors/id/A/AU/AUTHORS/Foo-Bar-version.tar.gz
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. π
--uninst-shadowsβ Uninstalls the shadow files of the distribution that you're installing. This eliminates the confusion if you're trying to install core (dual-life) modules from CPAN against perl 5.10 or older, or modules that used to be XS-based but switched to pure perl at some version.
β οΈ If you run cpanm as root and use INSTALL_BASE or equivalent to specify a custom installation path, you SHOULD disable this option so you won't accidentally uninstall dual-life modules from the core include path. Like, actually. π
Defaults to true if your perl version is smaller than 5.12, and you can disable that with --no-uninst-shadows.
NOTE: Since version1.3000this flag is turned off by default for perl newer than 5.12, since with 5.12@INCcontains thesite_perldirectory 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. π So yeah β off by default now, and that's a slay.
--uninstall,-Uβ Uninstalls a module from the library path. It finds a packlist for given modules, and removes all the files included in the same distribution. ποΈ
If you enable local::lib, it only removes files from the local::lib directory.
If you try to uninstall a module in the perl directory (i.e. a core module), an error will be thrown. π¨
A dialog will be prompted to confirm the files to be deleted. If you pass -f as well, the dialog will be skipped and uninstallation will be forced. No take-backs, bestie. π
--cascade-searchβ EXPERIMENTAL β¨ Specifies whether to cascade search when you specify multiple mirrors and a mirror doesn't have a module β or has a lower version of the module than requested. Defaults to false.--skip-installedβ Specifies whether a module given in the command line is skipped if its latest version is already installed. Defaults to true.
NOTE: ThePERL5LIBenvironment variable has to be correctly set for this to work with modules installed using local::lib, unless you always use the-loption. π«Ά
--skip-satisfiedβ EXPERIMENTAL β¨ Specifies whether a module (and version) given in the command line is skipped if it's already installed.
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 a version higher than 1.2. It's 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.
--verifyβ Verify the integrity of distribution files retrieved from CPAN using theCHECKSUMSfile, and theSIGNATURESfile (if found in the distribution). Defaults to false.
β οΈ Real talk: using this option does not verify the integrity of the CHECKSUMS file, and it's unsafe to rely on this option if you're using a CPAN mirror that you do not trust. Like, do not. π
--report-perl-versionβ Whether it reports the locally installed perl version to the various web servers as part ofUser-Agent. Defaults to true unless CI related environment variables such asTRAVIS,CIorAUTOMATED_TESTINGare enabled. You can disable it by using--no-report-perl-version. π€--auto-cleanupβ Specifies the number of days in which cpanm's work directories expire. Defaults to7, which means old work directories will be cleaned up in one week. π§Ήβ¨
You can set the value to 0 to make cpanm never cleanup those directories.
--man-pagesβ Generates man pages for executables (man1) and libraries (man3). π
Defaults to true (man pages generated) unless the -L|--local-lib-contained option is supplied, in which case it's set to false. You can disable it with --no-man-pages.
--lwpβ Uses theLWPmodule to download stuff over HTTP. Defaults to true, and you can say--no-lwpto disable using LWP β like when you want to upgrade LWP from CPAN on some broken perl systems. π§--wgetβ Uses GNU Wget (if available) to download stuff. Defaults to true, and you can say--no-wgetto disable using Wget. Fun fact π«Ά: versions of Wget older than1.9don't support the--retry-connrefusedoption used by cpanm.--curlβ Uses cURL (if available) to download stuff. Defaults to true, and you can say--no-curlto 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. π First come, first served, periodt.
πΈ ENVIRONMENT VARIABLES πΈ
PERL_CPANM_HOMEβ The directory cpanm should use to store downloads and to build and test modules. Defaults to the.cpanmdirectory in your user's home directory. π πPERL_CPANM_OPTβ If set, adds a set of default options to every cpanm command. These options come first, and so are overridden by command-line options. π
π¦ SEE ALSO π¦
App::cpanminusβ yeah, that's the whole list, and it's iconic. β¨
π COPYRIGHT π
Copyright 2010- Tatsuhiko Miyagawa.
π AUTHOR π
Tatsuhiko Miyagawa
And that's the whole page, bestie β you ate that π«Άπ
This absolute gem was rendered from the perl v5.42.2 docs, dated 2024-10-30, under the name App::cp...tscript(3). Go forth and install things correctly. πβ
π¦ where this page comes from
- alpine 3.24: perl-app-cpanminus-doc 1.7048-r0 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms