Simplify Perl Module Management With CPAN Minus
Perl may not be the hot topic, but that doesn't mean that admins don't need to worry about Perl modules. However, the standard CPAN shell can sometimes be a bit much to manage. If that's the case, consider switching to CPAN Minus.Perl may not be glamorous, but its modules are often hard to avoid. Oftentimes, the standard CPAN shell makes using them more difficult than it needs to be. If that's the case for you, consider switching to CPAN Minus.
What's CPAN Minus (or "cpanm" if you prefer the caps-challenged version) for? Installing CPAN modules, period. It can get, unpack, build, and install Perl modules from CPAN -- but it can't do any of the other stuff the CPAN shell can do. It's meant to require zero configuration, and it runs as a standalone application.
Once you've installed cpanm, you can start installing modules right away. To install a module, simply run
cpanm ModuleName or
cpanm--sudo ModuleName if you want to install the module system-wide and aren't logged in as root.
From there, cpanm will grab the module and dependencies -- without all the configuration the CPAN shell requires the first time out, and without a bunch of noise. Basically, you'll see what dependencies it has to fetch, and it will have a line for fetching, configuring, building, and installing each module. That's it. Very little muss and fuss. The idea is that cpanm is very minimalistic.
That does mean you're missing some functionality from the CPAN shell. You can't uninstall modules, build RPMs, and so on, but it does have a few options you might want to use. If you want to force installation of a module, for example, use the
-f option. If you want an even less verbose output than it already provides, use
-q to tell cpanm to produce very little output--or use
-v to bump it up the volume.
With the 1.4 release in March, cpanm is likely to be "the last major update." Author Tatsuhiko Miyagawa considers the client more or less feature-complete -- although it should continue to be receive bugfixes. And that's as it should be -- cpanm is a great little utility for any admin who must install and manage a few Perl modules and doesn't want to wrestle with the CPAN shell.
Joe 'Zonker' Brockmeier is a freelance writer and editor with more than 10 years covering IT. Formerly the openSUSE Community Manager for Novell, Brockmeier has written for Linux Magazine, Sys Admin, Linux Pro Magazine, IBM developerWorks, Linux.com, CIO.com, Linux Weekly News, ZDNet, and many other publications. You can reach Zonker at firstname.lastname@example.org and follow him on Twitter.