Dealing with CPAN has always felt a little weird. Today I found a nice shortcut for getting perl modules installed in a home directory, which is really useful for when you don’t have admin on the box, or if you simply prefer to keep your custom perl stuff all cinched up in a tidy homedir for ease of administration (or if you have to use custom modules on a machine with no dev tools; you can build them on a dev box and then just scp the entire ~/perl directory to where it’s needed).
LocalModInstall is a script that generates a modified Makefile for a perl module you wish to install, suitable for installing it into your home directory.
{42} andre@werk [work/perl-ldap-0.33] % perl ~/bin/LocalModInstall.pl /usr/bin/perl Makefile.PL PREFIX=/Users/andre/perl \ INSTALLMAN1DIR=/Users/andre/perl/usr/share/man/man1 \ INSTALLMAN3DIR=/Users/andre/perl/usr/share/man/man3 *** ExtUtils::AutoInstall version 0.59 *** Checking for dependencies... [Core Features] - Convert::ASN1 ...loaded. (0.19 >= 0.07) [SASL authentication] - Authen::SASL ...loaded. (2.09 >= 2) - Digest::MD5 ...loaded. (2.33) [LDAP URLs] - URI::ldap ...loaded. (1.11 >= 1.1) [LDAPS] - IO::Socket::SSL ...missing. (would need 0.81) ==> Auto-install the 1 optional module(s) from CPAN? [n] n [Read/Write DSML files] - XML::SAX::Base ...loaded. (1.04) [Read/Write LDIF files] - MIME::Base64 ...loaded. (3.05) *** ExtUtils::AutoInstall configuration finished. Writing Makefile for Net::LDAP Don't forget to use lib qw( /Users/andre/perl/System/Library/Perl/5.8.6/darwin-thread-multi-2level /Users/andre/perl/System/Library/Perl/5.8.6 /Users/andre/perl/Library/Perl/5.8.6/darwin-thread-multi-2level /Users/andre/perl/Library/Perl/5.8.6 ); in your scripts (prior to any other "use" statements) or to set PERL5LIB="/Users/andre/perl/System/Library/Perl/5.8.6/darwin-thread-multi-2level" PERL5LIB="$PERL5LIB:/Users/andre/perl/System/Library/Perl/5.8.6" PERL5LIB="$PERL5LIB:/Users/andre/perl/Library/Perl/5.8.6/darwin-thread-multi-2level" PERL5LIB="$PERL5LIB:/Users/andre/perl/Library/Perl/5.8.6" export PERL5LIB in your shell (or shell configuration file) and to set MANPATH="$MANPATH:/Users/andre/perl/usr/share/man/man1" MANPATH="$MANPATH:/Users/andre/perl/usr/share/man/man3" export MANPATH in your shell (or shell configuration file).
You would then ‘make’ and ‘make install’ like normal.
However, the ‘use lib’ suggestion that is supplied does not work in Mac OS X. The goods seem to be installed in ~/perl/lib/perl5/site_perl, which is not included in the suggested paths. Instead, I use:
use lib qw( /path/to/home/perl/lib/perl5/site_perl );