Tuesday, December 14, 2010

Day 14: an alternative CPAN installer

To install a CPAN module, you unpack it and run
perl Makefile.PL
make test
make install
perl Build.PL
./Build test
./Build install
depending wether ExtUtils::MakeMaker or Module::Build is used.

But I'm sure you know about the CPAN shell, which can be invoked by perl -MCPAN -e shell or cpan. But the options do not end here...

Some years ago, the development of CPAN.pm was stuck and a new client (CPANPLUS) was on the horizon. It had some really nice features (search for a module and then install some of the search results, without much typing). But I never switched to it, because it did not have an easy 'force' option. (Maybe it has now, I don't know.)

The development of CPAN.pm continued, it got colorful and less verbose, distroprefs was added.

So, what is the alternative, I want to talk about? It's cpanminus.

You can download it like perlbrew without installing any prerequisites:
curl -L http://cpanmin.us | perl - --sudo App::cpanminus
This line installs App::cpanminus itself.

The usage is very simple: cpanm module

See the documentation for the supported options.



  1. Having tried the various installers over the years, I have settled on cpanp (CPANPLUS.pm), I've just not been able to get on with anything else.

    I like the power and flexibility cpanp gives, and yes, it most definitely does have a --force option these days, although I obviously try to avoid using it when possible, which is something that is made easier by having the verbose mode on so I can actually see what's happening and what's being installed, which seems to be the antitheses of installers like cpanm.

    Like almost everything else though, choice is good :-)

    BTW, keep up the good work with providing your advent calendar.

  2. I think it was on my first German Perlworkshop, when Jos introduced CPANPLUS. I was really faszinated then. This must been 2003 or so. Good to know, that the development continued. I always had the impression, when Andreas continued to work on CPAN.pm, CPANPLUS stalled.

    Thanks for the kind words.


Note: Only a member of this blog may post a comment.