Which cpan installer is the right one? (CPAN.pm/CPANPLUS/cpanminus)

PerlCpan

Perl Problem Overview


There are multiple installers for cpan modules available; I know of at least CPAN.pm (comes with perl,) CPANPLUS, and cpanminus.

What is the difference between the three?

What situations call for using one over the other?

Are there other module installers I should know about?

Perl Solutions


Solution 1 - Perl

CPAN.pm (cpan) is the original client. It comes with Perl, so you already have it. It has the most features. It has a lot of configuration options to customize the way it works, though virtually everyone accepts the default installation. It integrates easily with local::lib.


cpanminus (cpanm) is an attempt to make a zero-configuration client that automatically does the right thing for most users. It's also designed to run well on systems with limited resources (e.g. a VPS). It doesn't come with Perl, but it's easy to install. It integrates easily with local::lib.

Its biggest limitation is its lack of configuration. If you want to do something unusual, it may not support it.


CPANPLUS (cpanp) is an attempt to make a CPAN API that Perl programs can use, instead of an app that you use from the command line. The cpanp shell is more of a proof-of-concept, and I don't know of any real advantages to using it.


In summary, I'd recommend either cpan or cpanm. If you have trouble configuring cpan, try cpanm. If your situation is unusual, try cpan.

Solution 2 - Perl

It's impossible answer this question because it is too subjective. :)

From my point of view: cpanm is the simplest way install perl modules. You can install cpanm with:

curl -L http://cpanmin.us | perl - --sudo App::cpanminus

and after it you can install modules with simple:

cpanm Some::Module

You can use cpanm for mirroring (part of) CPAN to you local machine too, so IMHO cpanm is the best for the most common CPAN needs.

Solution 3 - Perl

> Are there other module installers I > should know about?

If you're using a Linux distribution that packages CPAN modules, then it's worth using their package installation program to install modules. For example, Ubuntu/Debian have a huge number of CPAN modules that you can install using 'apt' and Red Hat/Centos/Fedora have a number that you can install using 'yum'.

Solution 4 - Perl

CPAN is the standard. cpanminus (cpanm) asks fewer questions (best most of the time). I don't know anyone that uses cpanplus.

Since what these modules do is download, compile and install (place files in correct places) they all should do the same task. Some of the difference has to do with the permissions level you have. Perhaps you want to install some things local to your user and some things globally then you need a finer adjustment. Developers may also need to control/interrupt the process for debugging etc.

For daily use, use cpanm, unless you are too lazy to install it, then CPAN is fine.

Solution 5 - Perl

cpanm uses much less memory. This makes it a better choice for environments where RAM is limited, such as shared hosting servers, where regular cpan might die before completing installation task, due to attempting to use more than available memory.

According to cpanm's (1.7044) documentation "When running, it requires only 10MB of RAM"

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSean McMillanView Question on Stackoverflow
Solution 1 - PerlcjmView Answer on Stackoverflow
Solution 2 - Perljm666View Answer on Stackoverflow
Solution 3 - PerlDave CrossView Answer on Stackoverflow
Solution 4 - PerlJoel BergerView Answer on Stackoverflow
Solution 5 - PerlFrancesc Roma-i FrigoleView Answer on Stackoverflow