如何安装Perl脚本的依赖项?

时间:2022-11-23 06:52:10

I am trying to execute a daemon that runs on Perl, and the file is called ffencoderd.pl. Every time I run it, it states that a file is missing, for example Can't Locate IO/Scalar.pm.

我正在尝试执行在Perl上运行的守护程序,该文件名为ffencoderd.pl。每次运行它时,都会指出文件丢失,例如无法定位IO / Scalar.pm。

So I go to CPAN.org and find the file and install it. The only problem is that I have just installed like 6 files and I am worried that there may be 20 more. Rather than keep running ffencoderd.pl and find that I need to install another file, I was wondering if there was a way to update perl. Are these files standard in a properly installed Perl? EX: Config-General-2.50, Pod-Xhtml-1.61, libxml-enno-1.02, etc.

所以我去CPAN.org找到该文件并进行安装。唯一的问题是我刚安装了6个文件,我担心可能还有20个。而不是继续运行ffencoderd.pl并发现我需要安装另一个文件,我想知道是否有更新perl的方法。这些文件是否在正确安装的Perl中标准化? EX:Config-General-2.50,Pod-Xhtml-1.61,libxml-enno-1.02等。

3 个解决方案

#1


8  

Updating Perl won't help you, because the missing modules are not part of the core Perl distribution; they have to be installed separately. Tools like cpanm will help you install modules (given a list of required modules), but they can't look at a script and figure out what modules it needs. The script's author should have done that, but apparently didn't. Update: If you're talking about this ffencoderd.pl, the author did list the required modules. You need to install IPC::ShareLite, Config::General, SOAP::Lite, XML::DOM, XML::Simple, Pod::WSDL, Pod::Xhtml, and HTML::Template.

更新Perl对您没有帮助,因为缺少的模块不是核心Perl发行版的一部分;它们必须单独安装。像cpanm这样的工具将帮助您安装模块(给定所需模块的列表),但是他们无法查看脚本并找出所需的模块。剧本的作者本应该这样做,但显然没有。更新:如果您正在讨论此ffencoderd.pl,作者确实列出了所需的模块。您需要安装IPC :: ShareLite,Config :: General,SOAP :: Lite,XML :: DOM,XML :: Simple,Pod :: WSDL,Pod :: Xhtml和HTML :: Template。

The easiest way to install these is to install cpanm and then type:

安装这些的最简单方法是安装cpanm然后键入:

cpanm IPC::ShareLite Config::General SOAP::Lite XML::DOM XML::Simple Pod::WSDL Pod::Xhtml HTML::Template

If you didn't have a list of modules to install, this question is about figuring out what the dependencies of a script are. In my answer you'll find a script that uses Module::ExtractUse to list a script's dependencies. The only modules you'll need to install are Module::ExtractUse and Module::CoreList (if you don't already have it). You'll need to tweak the script a bit for your situation.

如果您没有要安装的模块列表,那么这个问题就是要弄清楚脚本的依赖性是什么。在我的回答中,您将找到一个使用Module :: ExtractUse列出脚本依赖关系的脚本。您需要安装的唯一模块是Module :: ExtractUse和Module :: CoreList(如果您还没有它)。你需要根据你的情况稍微调整一下脚本。

#2


2  

Updating perl should be done through your package maganger. Module installation for perl from CPAN should be handled by the CPAN utility which is accessed general via command like with the command perl -MCPAN -e shell. CPAN will handle package requirements and proper installation procudure.

更新perl应该通过你的包maganger完成。来自CPAN的perl模块安装应由CPAN实用程序处理,该实用程序通过命令访问,如命令perl -MCPAN -e shell。 CPAN将处理包装要求和正确的安装过程。

#3


2  

You can get a list of core Perl modules in the documentation. I don't think any of the ones you listed are core though.

您可以在文档中获取核心Perl模块的列表。我认为你列出的任何一个都不是核心。

There are various utilities that will install modules and trace dependancies for you automatically. cpan and cpan minus for example. local::lib will let you install them in a specific directory (that you can add to your PERL5LIB environment variable) if you want to avoid a system wide install (as root).

有各种实用程序可以自动为您安装模块和跟踪依赖项。例如,cpan和cpan减去。如果要避免系统范围的安装(以root用户身份),local :: lib将允许您将它们安装在特定目录中(可以添加到PERL5LIB环境变量中)。

Note that some modules (such as those which use libxml) depend on non-Perl libraries to be installed.

请注意,某些模块(例如使用libxml的模块)依赖于要安装的非Perl库。

If you really want to upgrade Perl, then you could look at perlbrew, which helps you have multiple versions of Perl installed side by side.

如果你真的想要升级Perl,那么你可以看看perlbrew,它可以帮助你并排安装多个版本的Perl。

#1


8  

Updating Perl won't help you, because the missing modules are not part of the core Perl distribution; they have to be installed separately. Tools like cpanm will help you install modules (given a list of required modules), but they can't look at a script and figure out what modules it needs. The script's author should have done that, but apparently didn't. Update: If you're talking about this ffencoderd.pl, the author did list the required modules. You need to install IPC::ShareLite, Config::General, SOAP::Lite, XML::DOM, XML::Simple, Pod::WSDL, Pod::Xhtml, and HTML::Template.

更新Perl对您没有帮助,因为缺少的模块不是核心Perl发行版的一部分;它们必须单独安装。像cpanm这样的工具将帮助您安装模块(给定所需模块的列表),但是他们无法查看脚本并找出所需的模块。剧本的作者本应该这样做,但显然没有。更新:如果您正在讨论此ffencoderd.pl,作者确实列出了所需的模块。您需要安装IPC :: ShareLite,Config :: General,SOAP :: Lite,XML :: DOM,XML :: Simple,Pod :: WSDL,Pod :: Xhtml和HTML :: Template。

The easiest way to install these is to install cpanm and then type:

安装这些的最简单方法是安装cpanm然后键入:

cpanm IPC::ShareLite Config::General SOAP::Lite XML::DOM XML::Simple Pod::WSDL Pod::Xhtml HTML::Template

If you didn't have a list of modules to install, this question is about figuring out what the dependencies of a script are. In my answer you'll find a script that uses Module::ExtractUse to list a script's dependencies. The only modules you'll need to install are Module::ExtractUse and Module::CoreList (if you don't already have it). You'll need to tweak the script a bit for your situation.

如果您没有要安装的模块列表,那么这个问题就是要弄清楚脚本的依赖性是什么。在我的回答中,您将找到一个使用Module :: ExtractUse列出脚本依赖关系的脚本。您需要安装的唯一模块是Module :: ExtractUse和Module :: CoreList(如果您还没有它)。你需要根据你的情况稍微调整一下脚本。

#2


2  

Updating perl should be done through your package maganger. Module installation for perl from CPAN should be handled by the CPAN utility which is accessed general via command like with the command perl -MCPAN -e shell. CPAN will handle package requirements and proper installation procudure.

更新perl应该通过你的包maganger完成。来自CPAN的perl模块安装应由CPAN实用程序处理,该实用程序通过命令访问,如命令perl -MCPAN -e shell。 CPAN将处理包装要求和正确的安装过程。

#3


2  

You can get a list of core Perl modules in the documentation. I don't think any of the ones you listed are core though.

您可以在文档中获取核心Perl模块的列表。我认为你列出的任何一个都不是核心。

There are various utilities that will install modules and trace dependancies for you automatically. cpan and cpan minus for example. local::lib will let you install them in a specific directory (that you can add to your PERL5LIB environment variable) if you want to avoid a system wide install (as root).

有各种实用程序可以自动为您安装模块和跟踪依赖项。例如,cpan和cpan减去。如果要避免系统范围的安装(以root用户身份),local :: lib将允许您将它们安装在特定目录中(可以添加到PERL5LIB环境变量中)。

Note that some modules (such as those which use libxml) depend on non-Perl libraries to be installed.

请注意,某些模块(例如使用libxml的模块)依赖于要安装的非Perl库。

If you really want to upgrade Perl, then you could look at perlbrew, which helps you have multiple versions of Perl installed side by side.

如果你真的想要升级Perl,那么你可以看看perlbrew,它可以帮助你并排安装多个版本的Perl。