Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cpan vs -MCPAN - Perl

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?

like image 912
Hashim Aziz Avatar asked Feb 06 '23 05:02

Hashim Aziz


1 Answers

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.

like image 118
ikegami Avatar answered Feb 20 '23 22:02

ikegami