gpt4 book ai didi

default - cpanm 安装 Perl 模块的默认路径是什么?

转载 作者:行者123 更新时间:2023-12-01 15:05:06 31 4
gpt4 key购买 nike

在我使用 cpanm 之前要在"new"(对我而言)系统上安装一些 Perl 模块,我想知道默认情况下它们将安装在哪里。

我没有看到任何类型的空运行选项,这是我所希望的。
perl -V包括此 %ENV 和 @INC 信息:

%ENV:
PERL5LIB="/home/randall/perl5/lib/perl5"
PERL_HOMEDIR="1"
PERL_LOCAL_LIB_ROOT="/home/randall/perl5"
PERL_MB_OPT="--install_base /home/randall/perl5"
PERL_MM_OPT="INSTALL_BASE=/home/randall/perl5"
@INC:
/home/randall/perl5/lib/perl5
/usr/local/lib64/perl5
/usr/local/share/perl5
/usr/lib64/perl5/vendor_perl
/usr/share/perl5/vendor_perl
/usr/lib64/perl5
/usr/share/perl5

这是否定义了行为,还是有其他考虑因素?具体来说,cpanm 的文档包括:

-l, --local-lib
Sets the local::lib compatible path to install modules to. You don't
need to set this if you already configure the shell environment
variables using local::lib, but this can be used to override that as
well.


但它并没有指出哪些环境变量是重要的。

最佳答案

这可能会有所帮助:https://metacpan.org/pod/App::cpanminus#Where-does-this-install-modules-to?-Do-I-need-root-access?

Where does this install modules to? Do I need root access?

It installs to wherever ExtUtils::MakeMaker and Module::Build are configured to (via PERL_MM_OPT and PERL_MB_OPT).

By default, it installs to the site_perl directory that belongs to your perl. You can see the locations for that by running perl -V and it will be likely something under /opt/local/perl/... if you're using system perl, or under your home directory if you have built perl yourself using perlbrew or plenv.

If you've already configured local::lib on your shell, cpanm respects that settings and modules will be installed to your local perl5 directory.

At a boot time, cpanminus checks whether you have already configured local::lib, or have a permission to install modules to the site_perl directory. If neither, i.e. you're using system perl and do not run cpanm as a root, it automatically sets up local::lib compatible installation path in a perl5 directory under your home directory.

关于default - cpanm 安装 Perl 模块的默认路径是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41903944/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com