I'm currently running bash
via Cygwin on Windows, and I've come across two different ways to install a Perl module
cpan Name::Module
and
perl -MCPAN -e shell
install Name::Module
What's the difference between these two methods, and do they offer any advantages or disadvantages over the other?
cpan
installs for the perl
in the shebang (#!
) line of the cpan
file.
When someone has more than one perl
installed on a machine, they sometimes run the wrong copy of cpan
, and thus end up installing modules for the wrong instance of perl
.
One solution to that would be to specify the full path to the correct cpan
file.
perl -MCPAN -e shell
is the other solution. It allows you to explicitly specify the install of perl
for which you want the modules to be installed.