Perl本地安装的先决条件

时间:2012-02-03 18:21:56

标签: perl

我只是想安装一些Perl模块。我使用

将Spiffy-0.30安装到我的本地目录中
perl Makefile.PL PREFIX=~/lib LIB=~/lib

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

2 个答案:

答案 0 :(得分:2)

由于~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$

答案 1 :(得分:2)

如果您要在本地安装模块,我可以建议使用local::lib模块吗?大多数情况都让人头疼。