The Comprehensive Perl Archive Network (CPAN) is a collection of Perl modules and scripts distributed among a large number of mirror sites. CPAN is also the name of a perl module which provides an interface to install modules from CPAN. These notes document problems with CPAN on Mac OS X. See also the main Life with CPAN documentation.
Mac OS X 10.4 (Tiger) includes Perl 5.8.6; to build modules from CPAN, install the XCode development package, then use the cpan command:
$ which cpan
/usr/bin/cpan
$ sudo -H cpan -i Term::CallEditor
This would install the Term::CallEditor into a system-wide path. Peruse CPAN with a non-root account for information on installing modules to other locations, such as under a home directory. Consider also using Fink or MacPorts to install perl modules. These port or package systems provide the benefit of installing any necessary C libraries, which otherwise would need to be manually downloaded, compiled, and installed.
The default filesystem on Mac OS X (HFS+) folds case, unlike traditional Unix filesystems. Unix software that assumes HEAD and head are two different things on Mac OS X will end badly. For example, the LWP::UserAgent module installs /usr/bin/HEAD, which clobbers the existing /usr/bin/head utility. Solutions to this include not installing the HEAD and similar shortcuts, or ensuring these utilities are installed under /usr/local/bin instead. One way is to update the perl Makefile.PL arguments to install third-party utilities into a different directory than /usr/bin.
cpan> o conf makepl_arg "INSTALLBIN=/usr/local/bin INSTALLSCRIPT=/usr/local/bin"
cpan> o conf commit
Due to the rise in popularity of Mac OS X, most of these issues have been worked around in popular modules, such as LWP::UserAgent. However, older, or less frequently used modules may still contain code that assumes filesystem case sensitivity.
Perl 5.8.1 on Mac OS X 10.3 ships with broken settings that cause some modules installed from CPAN to install their manuals under the /man directory. This directory pollutes the root namespace, and is outside the places manuals are searched for by man(1).
To fix this problem, update the makepl_arg to set INSTALLSITEMAN1DIR and INSTALLSITEMAN3DIR manually.
$ grep makepl_arg /System/Library/Perl/5.8.1/CPAN/Config.pm
'makepl_arg' => q[INSTALLSITEMAN1DIR=/usr/share/man/man1 ↵
INSTALLSITEMAN3DIR=/usr/share/man/man3],