本地安装的 Perl 先决条件

标签 perl

我只是想安装一些 Perl 模块。我使用以下命令将 Spiffy-0.30 安装到本地目录中

perl Makefile.PL PREFIX=~/lib LIB=~/lib

效果很好。然后我尝试使用相同的代码安装 Test-Base-6.0,其中 Spiffy 是先决条件,并且它指出我缺少 Spiffy。有没有办法指示 Perl 在哪个目录中查找先决条件?

最佳答案

由于 ~lib 不是 Perl 模块的默认位置,因此您需要告诉 Perl 在哪里可以找到它。您可以使用 PERL5LIB 环境变量来做到这一点。这是我的 Ubuntu 盒子的终端输出。

standage@ubuntu:~$ mkdir ~/lib
standage@ubuntu:~$ tar xzf Spiffy-0.30.tar.gz
standage@ubuntu:~$ cd Spiffy-0.30/
standage@ubuntu:~/Spiffy-0.30$ perl Makefile.PL PREFIX=~/lib LIB=~/lib
Checking if your kit is complete...
Looks good
Writing Makefile for Spiffy
standage@ubuntu:~/Spiffy-0.30$ make
cp lib/Spiffy.pm blib/lib/Spiffy.pm
Manifying blib/man3/Spiffy.3pm
standage@ubuntu:~/Spiffy-0.30$ make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'inc', 'blib/lib', 'blib/arch')" t/*.t
t/autoload.t .. ok   
t/base.t ...... ok     
t/base2.t ..... ok   
t/cascade.t ... ok     
t/const.t ..... ok   
t/early.t ..... ok   
t/export1.t ... ok     
t/export2.t ... ok   
t/export3.t ... ok   
t/export4.t ... ok     
t/export5.t ... ok   
t/export6.t ... ok   
t/export7.t ... ok   
t/exporter.t .. ok   
t/field.t ..... ok   
t/field2.t .... ok   
t/field3.t .... ok   
t/filter.t .... ok   
t/filter2.t ... ok   
t/filter3.t ... ok   
t/filter4.t ... ok   
t/filter5.t ... ok   
t/mixin.t ..... ok     
t/mixin2.t .... ok     
t/mixin3.t .... ok   
t/new.t ....... ok   
t/package.t ... ok   
t/parse.t ..... ok   
t/stub.t ...... ok   
t/super.t ..... ok   
t/super2.t .... ok   
All tests successful.
Files=31, Tests=198,  2 wallclock secs ( 0.19 usr  0.30 sys +  0.88 cusr  0.48 csys =  1.85 CPU)
Result: PASS
standage@ubuntu:~/Spiffy-0.30$ make install
Installing /home/standage/lib/Spiffy.pm
Installing /home/standage/lib/man/man3/Spiffy.3pm
Appending installation info to /home/standage/lib/x86_64-linux-gnu-thread-multi/perllocal.pod
standage@ubuntu:~/Spiffy-0.30$ cd ..
standage@ubuntu:~$ tar xzf Test-Base-0.60.tar.gz 
standage@ubuntu:~$ cd Test-Base-0.60/
standage@ubuntu:~/Test-Base-0.60$ perl Makefile.PL PREFIX=~/lib LIB=~/lib
Checking if your kit is complete...
Looks good
Warning: prerequisite Spiffy 0.30 not found.
Writing Makefile for Test::Base
standage@ubuntu:~/Test-Base-0.60$ export PERL5LIB=~/lib:$PERL5LIB
standage@ubuntu:~/Test-Base-0.60$ perl Makefile.PL PREFIX=~/lib LIB=~/lib
Writing Makefile for Test::Base
standage@ubuntu:~/Test-Base-0.60$

关于本地安装的 Perl 先决条件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9133532/

相关文章:

perl - 在 Perl 中获取文件校验和的紧凑方法

c++ - 正则表达式添加匈牙利符号

perl - 如何使用 Perl 从网站下载链接目标?

perl - 如何通过管道使用 Parallel::ForkManager?

perl - 每个优秀的 Perl 开发人员都应该能够回答的问题

perl - 我如何让它停止删除文本文件中以前的内容?

linux - 如何在系统级别将目录添加到 Perl 库路径?

perl - 如何设置匿名 perl 函数的原型(prototype)

perl - 在 perl 中删除文件中的特定行

regex - 如何删除排除某些其他匹配行?