Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install multiple perl modules at once using CPAN

Tags:

perl

cpan

Is it possible to install multiple modules using CPAN? I've tried:

perl -MCPAN -e 'install DBIx::Transaction File::Basename::Object'

but I get this error:

Can't locate object method "Transaction" via package "DBIx" at -e line 1
like image 594
tvs Avatar asked Aug 25 '14 16:08

tvs


People also ask

How do I install Perl modules in CPAN?

One possible solution is to install libcgi-pm-perl , which currently replaces the default version by a supported one (2011-0-10). To do so, type sudo apt-get install libcgi-pm-perl from the command line or install it with your favorite package manager. Gentoo has ebuilds for the CPAN.


2 Answers

You need a separate install command for each module:

perl -MCPAN -e 'install DBIx::Transaction; install File::Basename::Object'

If you want to simplify the install process even more, take a look at cpanm, which requires no configuration and by default will install modules without prompting.

You can install both modules with a single cpanm command like this:

cpanm DBIx::Transaction File::Basename::Object

Although as ikegami points out, this is not exactly the same as the first command since you can't specify which version of perl to use.

like image 124
ThisSuitIsBlackNot Avatar answered Oct 27 '22 12:10

ThisSuitIsBlackNot


cpan DBIx::Transaction File::Basename::Object

or if you're trying to make sure a specific perl is used,

perl -MCPAN -e'install($_) for qw( DBIx::Transaction File::Basename::Object )'
like image 9
ikegami Avatar answered Oct 27 '22 13:10

ikegami