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

查看:40
本文介绍了在 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?

提前致谢.

推荐答案

方法一:使用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.

方法二:改变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天全站免登陆