本地安装的Perl先决条件

问题描述:

我只是试图安装一些Perl模块。我使用本地安装的Perl先决条件

将Spiffy-0.30安装到我的本地目录中,并且工作正常。然后我尝试安装Test-Base-6.0,Spiffy是使用相同代码的先决条件,并声明我缺少Spiffy。有没有办法指示Perl寻找哪些目录的先决条件?

+0

我认为,如果'〜/ lib'是在'PERL5LIB'路径,Perl将可以安装其他模块时找到它。给那一枪。 – 2012-02-03 18:35:23

+0

No〜/ lib是我创建的目录,我需要它安装在我创建的目录中,以便我可以将其与我的脚本一起包含。 – chrstahl89 2012-02-03 18:36:59

+0

没错。既然你创建了它,你需要告诉Perl它在哪里。我认为'PERL5LIB'环境变量可以做到这一点。 – 2012-02-03 18:42:25

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

[email protected]:~$ mkdir ~/lib 
[email protected]:~$ tar xzf Spiffy-0.30.tar.gz 
[email protected]:~$ cd Spiffy-0.30/ 
[email protected]:~/Spiffy-0.30$ perl Makefile.PL PREFIX=~/lib LIB=~/lib 
Checking if your kit is complete... 
Looks good 
Writing Makefile for Spiffy 
[email protected]:~/Spiffy-0.30$ make 
cp lib/Spiffy.pm blib/lib/Spiffy.pm 
Manifying blib/man3/Spiffy.3pm 
[email protected]:~/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 
[email protected]:~/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 
[email protected]:~/Spiffy-0.30$ cd .. 
[email protected]:~$ tar xzf Test-Base-0.60.tar.gz 
[email protected]:~$ cd Test-Base-0.60/ 
[email protected]:~/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 
[email protected]:~/Test-Base-0.60$ export PERL5LIB=~/lib:$PERL5LIB 
[email protected]:~/Test-Base-0.60$ perl Makefile.PL PREFIX=~/lib LIB=~/lib 
Writing Makefile for Test::Base 
[email protected]:~/Test-Base-0.60$ 

如果您打算在本地安装模块,我可以建议local::lib模块吗?它使大部分的头痛消失了。