本文介绍了手动安装 Perl 模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经下载了模块 Digest::SHA1 并将其解压缩到目录 (../Digest-SHA1-2.13/) ,然后将所有 SHA1.* 文件复制到 (../摘要-SHA1-2.13/摘要)

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 相同)抱怨它可以在 @INC 中找到它

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::FAQModule::Build

For more info see the perldoc for ExtUtils::MakeMaker::FAQ and Module::Build

这篇关于手动安装 Perl 模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 20:47