Installing CPAN Modules

We suggest limiting your customization of the Perl that came with Mac OS X, since it’s fair game for modification during an upgrade or patch. You could either end up modifying something that the system depends on, or you could end up with a partially broken Perl installation the next time Software Update performs a big Mac OS X update.

It’s fine to install whatever Perl modules you want, but if you choose to install a customized or newer version of Perl, install it in /usr/local so it doesn’t interfere with the one in /usr. You should use /usr/bin/cpan (a shell interface to the CPAN.pm module) to install modules, but don’t stray too far from your desk when you’re doing this—you might come back to find that your module selection led to a dependency that tried to do you a favor by upgrading Perl to the latest version.

Warning

Jaguar users won’t have /usr/bin/cpan. Use the perl -MCPAN -e shell command instead.

The first time you use the CPAN shell, it asks many questions about how you’d like to set it up (you can enter the initial CPAN configuration any time by issuing the command o conf init within the CPAN shell):

$ sudo cpan
Password: ******** /System/Library/Perl/5.8.1/CPAN/Config.pm initialized. CPAN is the world-wide archive of perl resources. It consists of about 100 sites that all replicate the same contents all around the globe. Many countries have at least one CPAN site already. The resources found on CPAN are easily accessible with the CPAN.pm module. ...

Get Mac OS X Panther for Unix Geeks, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.