我目前正在尝试安装一个 Perl 模块,但是网络托管已专门锁定了自定义 Perl 用户安装目录(他们有一个“安装服务”,每个模块收费 7 美元)。
所以我所做的是这样的:
o conf makepl_arg INSTALL_BASE=~/USERNAME/lib
o conf mbuildpl_arg "--install_base ~/USERNAME/lib"
o conf makepl_arg "PREFIX=~/USERNAME/lib"
然后在运行时,我尝试:
perl -MCPAN -e 'use lib "~/USERNAME/lib";shell;'
我尝试安装,它拒绝搜索我的自定义库目录:
Running install for module 'Canary::Stability'
Checksum for /www/webvol28/dt/ziz4exwdzkng352/.cpan/sources/authors/id/M/ML/MLEHMANN/Canary-Stability-2013.tar.gz ok
Configuring M/ML/MLEHMANN/Canary-Stability-2013.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Canary::Stability
Writing MYMETA.yml and MYMETA.json
MLEHMANN/Canary-Stability-2013.tar.gz
/usr/local/bin/perl Makefile.PL PREFIX=~/USERNAME/lib -- OK
Running make for M/ML/MLEHMANN/Canary-Stability-2013.tar.gz
cp Stability.pm blib/lib/Canary/Stability.pm
Manifying 1 pod document
MLEHMANN/Canary-Stability-2013.tar.gz
/usr/bin/make -- OK
The current configuration of allow_installing_outdated_dists is 'ask/no', but for this option we would need 'CPAN::DistnameInfo' installed. Please install 'CPAN::DistnameInfo' as soon as possible. As long as we are not equipped with 'CPAN::DistnameInfo' this option does not take effect
Running make test for MLEHMANN/Canary-Stability-2013.tar.gz
PERL_DL_NONLAZY=1 "/usr/local/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00_load.t .. ok
All tests successful.
Files=1, Tests=1, 0 wallclock secs ( 0.03 usr 0.01 sys + 0.00 cusr 0.01 csys = 0.05 CPU)
Result: PASS
MLEHMANN/Canary-Stability-2013.tar.gz
/usr/bin/make test -- OK
Running make install for MLEHMANN/Canary-Stability-2013.tar.gz
Manifying 1 pod document
Appending installation info to /www/webvol28/dt/ziz4exwdzkng352/USERNAME/lib/lib/perl5/5.32/mach/perllocal.pod
MLEHMANN/Canary-Stability-2013.tar.gz
/usr/bin/make install -- OK
MLEHMANN/JSON-XS-4.03.tar.gz
Has already been unwrapped into directory /www/webvol28/dt/ziz4exwdzkng352/.cpan/build/JSON-XS-4.03-7
Configuring M/ML/MLEHMANN/JSON-XS-4.03.tar.gz with Makefile.PL
Can't locate Canary/Stability.pm in @INC (you may need to install the Canary::Stability module) (@INC contains: /usr/local/lib/perl5/site_perl/mach/5.32 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.32/mach /usr/local/lib/perl5/5.32 .) at Makefile.PL line 4.
BEGIN failed--compilation aborted at Makefile.PL line 4.
Warning: No success on command[/usr/local/bin/perl Makefile.PL PREFIX=~/USERNAME/lib]
MLEHMANN/JSON-XS-4.03.tar.gz
/usr/local/bin/perl Makefile.PL PREFIX=~/USERNAME/lib -- NOT OK
Failed during this command:
(optional) MLEHMANN/JSON-XS-4.03.tar.gz : writemakefile NO '/usr/local/bin/perl Makefile.PL PREFIX=~/USERNAME/lib' returned status 512
您可以看到它成功安装了先决条件Canary::Stability
,但随后加载失败:
无法在 @INC 中找到 Canary/Stability.pm(您可能需要安装 Canary::Stability 模块)(@INC 包含:/usr/local/lib/perl5/site_perl/mach/5.32 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.32/mach /usr/local/lib/perl5/5.32 。)在 Makefile.PL 第 4 行。
也尝试过 lib 文件夹等,但没用。似乎只能搜索“官方”文件夹,这些文件夹权限已锁定,因此只有网站托管管理员才能安装。
知道如何“强制”安装脚本找到我的自定义文件夹吗?
答案1
您只需导出PERL5LIB
:
export PERL5LIB='/www/webvol28/dt/ziz4exwdzkng352/USERNAME/lib/'