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
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.
cpan DBIx::Transaction File::Basename::Object (use a cpan and the perl it was installed with), not perl -MCPAN -e 'install DBIx::Transaction; install File::Basename::Object' (use the specified perl). // Not sure how installing a whole new installer is easier than pressnig Enter the first time cpan is used.cpanm over cpan since it is 1) less verbose, 2) doesn't prompt by default, and 3) seems to Just Work more often than cpan. I know you can configure cpan to not prompt and such, but I'd rather install cpanm with a single command and never have to worry about configuration again.prerequisites_policy. In context, it actually complicates the process by getting someone to convert from a known and used system. // As for working, I've never had a single problem with cpan across 3 OSs and 8 version of Perl. // As for verbosity, 99% of the output comes from the installers, not cpan.cpan DBI produced 794 lines of output compared to only 6 for cpanm DBI. The first time I tried installing a module with cpan, I was prompted to answer about a long series of questions about configuration, many of which were utterly meaningless to me as someone new to Perl. I had to do that on every system I wanted to install a module on, which was annoying enough that I just installed cpanm and never bothered with cpan again. I think cpanm is more beginner friendly than cpan, hence my recommendation.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.