tvs
tvs

Reputation: 799

How to install multiple perl modules at once using 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

Upvotes: 8

Views: 12547

Answers (2)

ikegami
ikegami

Reputation: 386561

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

Use the cpan that was installed by the perl for which you want to install.


If you have problems installing for the correct perl, explicitly use the correct perl.

.../perl -S cpan DBIx::Transaction File::Basename::Object

or

.../perl -MCPAN -e'install($_) for @ARGV' DBIx::Transaction File::Basename::Object

The problem you have is the unquoted use of DBIx::Transaction.

Upvotes: 10

ThisSuitIsBlackNot
ThisSuitIsBlackNot

Reputation: 24083

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.

Upvotes: 13

Related Questions