运行以下命令会返回多条路径:
perl -e 'print join("\n",@INC,"")'
每个路径都安装了模块。我想以root身份将模块安装到以下目录中:
/usr/local/share/perl5
我应该运行哪些命令来查找cpan当前安装模块的位置?如果不是上面显示的路径,该如何修改它?
以下是我如何配置cpan
,使所有新模块都存储在特定目录中:
o conf makepl_arg 'PREFIX=/usr/local/share/perl5 INSTALLMAN3DIR=/usr/local/share/perl5/man/man3'
o conf mbuild_arg '--install_base /usr/local/share/perl5'
o conf mbuild_install_arg '--install_base /usr/local/share/perl5'
o conf mbuildpl_arg '--install-base /usr/local/share/perl5'
[o conf commit]
ExtUtils::MakeMaker
的模块,接下来的三行针对使用 Module::Build
的模块。o conf
(全部)或 o conf {name}
将显示当前值,可能为空白。使用 perl -V:'.*inst.*'
查看 perl
默认使用的目录。 - ikegami你也可以通过 App::cpm 轻松地完成这个操作。
$ cpm install -L my-random-folder Open::This
DONE install Path-Tiny-0.108 (using prebuilt)
DONE install Try-Tiny-0.30 (using prebuilt)
DONE install Module-Build-0.4224 (using prebuilt)
DONE install Module-Runtime-0.016 (using prebuilt)
DONE install Open-This-0.000008 (using prebuilt)
5 distributions installed.
$ tree my-random-folder
my-random-folder
├── bin
│ ├── config_data
│ └── ot
└── lib
└── perl5
├── 5.26.1
│ └── darwin-2level
├── Module
│ ├── Build
│ │ ├── API.pod
│ │ ├── Authoring.pod
│ │ ├── Base.pm
│ │ ├── Bundling.pod
│ │ ├── Compat.pm
│ │ ├── Config.pm
│ │ ├── ConfigData.pm
│ │ ├── Cookbook.pm
│ │ ├── Dumper.pm
│ │ ├── Notes.pm
│ │ ├── PPMMaker.pm
│ │ ├── Platform
│ │ │ ├── Default.pm
│ │ │ ├── MacOS.pm
│ │ │ ├── Unix.pm
│ │ │ ├── VMS.pm
│ │ │ ├── VOS.pm
│ │ │ ├── Windows.pm
│ │ │ ├── aix.pm
│ │ │ ├── cygwin.pm
│ │ │ ├── darwin.pm
│ │ │ └── os2.pm
│ │ └── PodParser.pm
│ ├── Build.pm
│ └── Runtime.pm
├── Open
│ └── This.pm
├── Path
│ └── Tiny.pm
├── Try
│ └── Tiny.pm
└── darwin-2level
└── auto
├── Module
│ ├── Build
│ └── Runtime
├── Open
│ └── This
├── Path
│ └── Tiny
└── Try
└── Tiny