如何对非标准位置中安装的Perl模块使用依赖项?

时间:2010-06-18 02:36:02

标签: perl perl-module

我需要在Web主机上安装两个Perl模块。我们称它们为A :: B和X :: Y. X :: Y依赖于A :: B(需要A :: B才能运行)。他们都使用Module::Install。我已使用

成功将A :: B安装到非系统位置
perl Makefile.PL PREFIX=/non/system/location
make; make test; make install

现在我想安装X :: Y,所以我尝试了同样的事情

perl Makefile.PL PREFIX=/non/system/location

输出

$ perl Makefile.PL PREFIX=/non/system/location/
Cannot determine perl version info from lib/X/Y.pm
*** Module::AutoInstall version 1.03
*** Checking for Perl dependencies...
[Core Features]
- Test::More          ...loaded. (0.94)
- ExtUtils::MakeMaker ...loaded. (6.54 >= 6.11)
- File::ShareDir      ...loaded. (1.00)
- A::B                ...missing.
==> Auto-install the 1 mandatory module(s) from CPAN? [y] 

虽然它已经安装,但它似乎无法在系统中找到A :: B,并且当它尝试从CPAN自动安装模块时,它会尝试将其写入系统目录(忽略PREFIX)。我在PERL_LIB之后尝试在命令行上使用LIBPREFIX=...之类的变量,但我所做的一切似乎都没有用。

我可以成功makemake install,但由于此问题我无法make test。有什么建议吗?

我在http://servers.digitaldaze.com/extensions/perl/modules.html找到了一些使用环境变量PERL5LIB的建议,但这似乎也不起作用:

export PERL5LIB=/non/system/location/lib/perl5/

没有解决问题。

3 个答案:

答案 0 :(得分:0)

好的,以下处方做到了:

perl Makefile.PL --skipdeps --no-manpages PREFIX=/non/system/location INSTALLSITELIB=/non/system/location/lib INSTALLSITEBIN=/non/system/location/bin INSTALLMAN1DIR=/non/system/location/man/man1 INSTALLMAN3DIR=/non/system/location/man/man3

这只是“猴子见猴子”但现在make test有效。

  • 这里的--skipdeps选项会阻止Module :: Install的一个方便的功能/恼怒问题,它会尝试使用CPAN.pm来下载丢失的模块。
  • --no-manpages应该停止安装手册页,但它不起作用。

答案 1 :(得分:0)

答案是local::lib,但您可能already know that:)

答案 2 :(得分:0)

因为这是最重要的链接,我认为我会根据自己的经验进行更新(这需要一段时间才能开始工作,因此更新了7岁的帖子)。

首先运行perl -le 'print join $/, @INC'

添加(注意,没有/最后!!) export PERL5LIB=/nonstddir/scripts/modules/lib/site_perl:/nonstddir/scripts/modules/lib

运行perl -le 'print join $/, @INC'确保添加新目录。这使它工作。如果在路径的末尾添加/,则INC条目看起来很奇怪和错误。我的中间有一个//。

完成和工作后,我的看起来像

/nonstddir/scripts/modules/lib/site_perl/5.8.4/sun4-solaris-64int
/nonstddir/scripts/modules/lib/site_perl/5.8.4
/nonstddir/scripts/modules/lib/site_perl
/nonstddir/scripts/modules/lib/sun4-solaris-64int
/nonstddir/scripts/modules/lib
/usr/perl5/5.8.4/lib/sun4-solaris-64int
/usr/perl5/5.8.4/lib
/usr/perl5/site_perl/5.8.4/sun4-solaris-64int
/usr/perl5/site_perl/5.8.4
/usr/perl5/site_perl
/usr/perl5/vendor_perl/5.8.4/sun4-solaris-64int
/usr/perl5/vendor_perl/5.8.4
/usr/perl5/vendor_perl