What is the difference between the cpan/cpanm and cpm commands? I'm perl-begginer. What I can use: cpan/cpanm or cpm? Thanks.
Asked
Active
Viewed 807 times
0
-
Turns out the answer on that other question is way better than what we've got here. Should have looked first. I'll leave my answer up anyway as it adds value. – simbabque May 21 '18 at 12:10
1 Answers
8
These are all different programs that essentially do the same thing. They install modules from the CPAN (Comprehensive Perl Archive Network) to your computer.
cpan
is the utility that Perl brings to install modules. It can be used as a shell or a simple command line utility. It uses the module CPAN under the hood.cpanp
is the utility to use the CPANPLUS module. It also has an integrated shell, and in general is a bit faster than the classiccpan
tool.cpanm
is a faster, less fully-featured CPAN client that comes with the App::cpanminus distribution. It does not have a shell, and is the de-facto standard today, as most people recommend using it. It's fast, easy to use and usually you don't have to care about what is happening behind the scenes. There's also the handycpanm-reporter
in a separate distribution, that you can use to send test reports of your installations to cpantesters.org, which will then show up on metaCPAN and in other places, so other people know whether a certain dist will work with their OS and Perl version.cpm
is yet another client to install modules from CPAN. It's relatively new and claims to be very fast. It uses Menlo under the hood, which is the new backend the author ofcpanm
is working on to replace the internals of that one. It does not have a shell.
If all you want to do is install modules, it really doesn't matter what you use. cpan
will always be available, but once you're used to cpanm
it starts feeling a bit tedious.
I suggest you use whatever you feel comfortable with.

simbabque
- 53,749
- 8
- 73
- 136
-
Re "*cpanm is a faster*", What part is faster, the part where it downloads the dist, or the part where it executes Makefile.PL/Build.PL /// Re "*[cpanm] is the de-facto standard today*", No, perl still comes with `cpan` and not `cpanm`. /// Re "*once you're used to `cpanm` it starts feeling a bit tedious.*", No, `cpan Module` doesn't get tedious. At least not more than `cpanm Module`. /// Why can't proponents of `cpanm` ever give any non-fictional reasons for using it? – ikegami May 22 '18 at 04:25
-
cpanm has a feature to skip testing, which means you can skip a lot of the work it would do by default. I think that's where the speed argument comes from. It also does tricks to avoid the big download of the PAUSE data files, as I recall. – brian d foy Mar 26 '20 at 22:27