I thought I had it working.
I have an entirely private version of Perl 5.16 (by private I mean local to my home directory), and a private place for CPAN modules. I followed the instructions at http://blog.fox.geek.nz/2010/09/installing-multiple-perls-with.html (adjusting for its slight out-of-datedness), which claims to entirely sidestep the need for local::lib. I used the cpanm that the above-mentioned instrux installed, to install Cache::Memcached::Fast.pm, and successfully ran a Perl program that used this module.
Today it's not working.
Can't locate Cache/Memcached/Fast.pm in @INC (@INC contains:
/Users/chap/perl5/perlbrew/perls/perl-5.16.1/lib/site_perl/5.16.1/darwin-2level
/Users/chap/perl5/perlbrew/perls/perl-5.16.1/lib/site_perl/5.16.
/Users/chap/perl5/perlbrew/perls/perl-5.16.1/lib/5.16.1/darwin-2level
/Users/chap/perl5/perlbrew/perls/perl-5.16.1/lib/5.16.1 .) at ./memget line 11.
Some troubleshooting:
/Users/chap$ perlbrew use
Currently using perl-5.16.1
...sweet.
/Users/chap$ which perl
/Users/chap/perl5/perlbrew/perls/perl-5.16.1/bin/perl
...awesome.
/Users/chap$ perlbrew switch perl-5.16.1
/Users/chap$ cpanm --interactive -v App::cpanoutdated
cpanm (App::cpanminus) 1.5014 on perl 5.012004 built for darwin-thread-multi-2level
Work directory is /Users/chap/.cpanm/work/1350175791.76873
You have make /usr/bin/make
You have LWP 6.03
You have /usr/bin/tar: bsdtar 2.8.3 - libarchive 2.8.3
You have /usr/bin/unzip
Searching App::cpanoutdated on cpanmetadb ...
!
! Can't write to /Library/Perl/5.12 and /usr/local/bin: Installing modules to /Users/chap/perl5
! To turn off this warning, you have to do one of the following:
! - run me as a root or with --sudo option (to install to /Library/Perl/5.12 and /usr/local/bin)
! - Configure local::lib your existing local::lib in this shell to set PERL_MM_OPT etc.
! - Install local::lib by running the following commands
!
! cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
!
Checking if you have ExtUtils::MakeMaker 6.31 ... Yes (6.62)
Checking if you have ExtUtils::Install 1.46 ... Yes (1.55)
App::cpanoutdated is up to date. (0.23)
Uh oh. Why the system Perl???
If you skipped or goofed step 6 (setup 'cpanm' for each perl) then you may be running a cpanm that was previously installed with the system perl, hence it wants to write in the system directories.
Recent versions of perlbrew have an 'install-cpanm' command that installs cpanm in a special location outside of any perl. That way, you don't have to install cpanm for each perl that you brew. This may be what you need.