← 返回命令列表

Linux command

cpanm 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Install a Perl module

cpanm [Module::Name]

Install module locally

cpanm -l ~/perl5 [Module::Name]

Install from cpanfile

cpanm --installdeps .

Install specific version

cpanm [Module::Name]@[1.23]

Install from Git repository

cpanm [git://github.com/user/repo.git]

Uninstall a module

cpanm -U [Module::Name]

Show what would be installed

cpanm --info [Module::Name]

Install quietly

cpanm -q [Module::Name]

说明

cpanm (cpanminus) is a script to install Perl modules from CPAN (Comprehensive Perl Archive Network). It provides a simpler, faster alternative to the traditional CPAN shell with minimal dependencies and configuration. The tool automatically resolves and installs dependencies, downloads modules from CPAN mirrors, runs tests, and installs to the appropriate location. It supports local::lib for user-local installations without root privileges. cpanm can install modules by name, from tarballs, from Git repositories, or from URLs. The cpanfile format allows declaring project dependencies that cpanm can install with --installdeps.

参数

-l, --local-lib _path_
Install modules to local directory.
-L, --local-lib-contained _path_
Install to directory with contained dependencies.
-n, --notest
Skip running tests.
-q, --quiet
Quiet output.
-v, --verbose
Verbose output.
-f, --force
Force install even if tests fail.
-U, --uninstall
Uninstall module.
--installdeps
Install dependencies only.
--info
Show module information without installing.
--look
Download and unpack, then open shell.
--mirror _url_
CPAN mirror URL.
--sudo
Use sudo for installation.

FAQ

What is the cpanm command used for?

cpanm (cpanminus) is a script to install Perl modules from CPAN (Comprehensive Perl Archive Network). It provides a simpler, faster alternative to the traditional CPAN shell with minimal dependencies and configuration. The tool automatically resolves and installs dependencies, downloads modules from CPAN mirrors, runs tests, and installs to the appropriate location. It supports local::lib for user-local installations without root privileges. cpanm can install modules by name, from tarballs, from Git repositories, or from URLs. The cpanfile format allows declaring project dependencies that cpanm can install with --installdeps.

How do I run a basic cpanm example?

Run `cpanm [Module::Name]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -l, --local-lib _path_ do in cpanm?

Install modules to local directory.