在Perl中自动安装Perl依赖项 [英] Installing perl dependency automatically in perl

查看:103
本文介绍了在Perl中自动安装Perl依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Perl的新手.我希望我可以从perl安装一些软件包,我是这样的:

I'm very new to perl. I wish I could install some package from perl, I did so like this :

perl -MCPAN -e 'install VM::EC2'

由于依赖性,它失败了,它显示:

Its getting failed due to dependency I guess, it shows :

Result: FAIL
Failed 8/8 test programs. 9/9 subtests failed.
  LDS/VM-EC2-1.20.tar.gz
one dependency not OK (XML::Simple); additionally test harness failed
  ./Build test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
  reports LDS/VM-EC2-1.20.tar.gz
Running Build install
  make test had returned bad status, won't install without force

在这种情况下,我如何要求perl自动安装XML::Simple和其他功能?

In this case how do I ask perl to install XML::Simple and other depedency automatically?

谢谢.

推荐答案

方法1:使用cpanm

您可以使用 cpanm ,然后使用cpanm modulename命令.

You can either use cpanm and then use cpanm modulename command.

cpanm VM::EC2

以上命令将自动安装VM :: EC2模块及其所有依赖项.

The above command will install VM::EC2 module with all its dependencies automatically.

方法2:更改CPAN的配置

或者您可以直接告诉CPAN

or you can tell CPAN directly

$ perl -MCPAN -e shell
cpan[1]>  o conf prerequisites_policy follow
cpan[2]>  o conf commit
exit

第一行将您的依赖性策略设置为遵循而不是询问(默认).第二行告诉CPAN将更改写入用户的CPAN配置文件,以使更改永久生效.

The first line sets your dependency policy to follow rather than ask (the default). The second line tells CPAN to write the changes to your user's CPAN configuration file to make them permanent.

因此,下一次您尝试从CPAN Shell安装Perl模块时,它将在不提示您的情况下安装其所有依赖项.

So the next time you try to install Perl module from CPAN shell, it will install all its dependencies without prompting you.

这篇关于在Perl中自动安装Perl依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆