手动安装Perl模块 [英] Manual installation of a Perl Module
问题描述
我已经下载了模块Digest::SHA1
并将其提取到目录(../Digest-SHA1-2.13/)中,然后将所有SHA1.*文件复制到(../Digest-SHA1-2.13/Digest)中
I have downloaded the module Digest::SHA1
and extracted it to a directory (../Digest-SHA1-2.13/) , then copied all the SHA1.* files into (../Digest-SHA1-2.13/Digest)
在perl脚本中,我做了:使用Digest :: SHA1; 启动脚本,如下所示:
and in the perl script, I did : use Digest::SHA1; launching the script like this:
perl -I ../Digest-SHA1-2.13/Digest perlscriptname.pl
我收到此错误:
Can't locate loadable object for module Digest::SHA1 in @INC
我认为它与共享库(* .so)有关吗?我不知道如何从这里继续.
I assume it has something to do with a shared library (*.so)?, I have no idea how to continue from here.
我可以使用CPAN(-MCPAN)模块直接安装它,因为我没有该服务器的权限来执行此操作,并且只能在本地安装(运行应用程序的地方).
我的最终目标是使用依赖于Digest::SHA1
I can install it directly using CPAN (-MCPAN) module, as I dont have permissions on that server to do that, and can install only locally (where the application is running).
My final goal is to use Algorithm::CouponCode
which is dependent on Digest::SHA1
奇怪的是,我已经安装了Digest::SHA1
(perl -MDigest::SHA1 -e 'print $Digest::SHA1::VERSION'
显示版本2.11),但仍然Algorithm::CouponCode
(安装方式与Digest::SHA1
相同)抱怨它可以在
The weird part is, that I have Digest::SHA1
installed (perl -MDigest::SHA1 -e 'print $Digest::SHA1::VERSION'
shows version 2.11), still Algorithm::CouponCode
(which is installed the same way I did with Digest::SHA1
) complains it can find it in @INC
谢谢!
推荐答案
使用此食谱手动安装perl模块:
Use this recipe for manually installing perl modules:
tar zxf Digest-SHA1-2.13.tar.gz
cd Digest-SHA1-2.13
perl Makefile.PL
make
make test
make install
请注意,某些发行版将具有Build.PL
文件而不是Makefile.PL
.在这种情况下,请使用以下配方:
Note that some distributions will have a Build.PL
file instead of Makefile.PL
. In that case use this recipe:
tar zxf ...
cd ...
perl Build.PL
./Build
./Build test
./Build install
(您可能只需运行make install
和./Build install
就能解决这个问题.)
(You may be able to get by with just running make install
and ./Build install
.)
如果您需要更改安装目录,请使用:
If you need to alter the installation dir then use:
perl Makefile.PL INSTALL_BASE=...
或
perl Build.PL --install_base ...
取决于模块的类型.
有关更多信息,请参见 ExtUtils :: MakeMaker :: FAQ 和 Module :: Build
For more info see the perldoc for ExtUtils::MakeMaker::FAQ and Module::Build
这篇关于手动安装Perl模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!