Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing perl dependency automatically in 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

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

Thanks in advance.

like image 975
sriram Avatar asked Dec 28 '12 08:12

sriram


People also ask

What is CPAN module in Perl?

The Comprehensive Perl Archive Network (CPAN) is a repository of over 250,000 software modules and accompanying documentation for 39,000 distributions, written in the Perl programming language by over 12,000 contributors.


2 Answers

Method 1: Using cpanm

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

cpanm VM::EC2

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

Method 2: Changing configuration of CPAN

or you can tell CPAN directly

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

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.

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

like image 119
Chankey Pathak Avatar answered Oct 30 '22 16:10

Chankey Pathak


You could use cpanm:

perl -MCPAN -e 'App::cpanminus'

and then

cpanm VM::EC2

look at the documentation for other features.

like image 20
Matteo Avatar answered Oct 30 '22 16:10

Matteo