Tuesday, September 7, 2010

MacPorts Perl CPAN on OS X 10.6.4 Snow Leopard

Try to install CPAN Modules in your non-root account for your MacPorts Perl on OS X 10.6.4 Snow Leopard and you're in for some nasty surprise:
You'll find your local MyCPAN.pm will eventually be silently ignored and ~/Library/Application\ Support/.cpan used instead. As much as I detest fiddling with the configuration of standard tools in OS X, I had no choice:
cpan
o conf build_dir /Users/bwagner/.cpan/build
o conf cpan_home /Users/bwagner/.cpan
o conf histfile /Users/bwagner/.cpan/histfile
o conf keep_source_where /Users/bwagner/.cpan/sources
o conf prefs_dir /Users/bwagner/.cpan/prefs
o conf commit
After this change and removing my ~/.cpan and starting afresh, things worked out.
The terrible thing is, this behavior starts only after installation of some particular modules. As it turns out it happens after the direct or indirect installation of File::HomeDir. Good luck trying to figure that one out.

Here are some related posts:
http://www.nntp.perl.org/group/perl.module-authors/2009/09/msg7886.html
http://www.nntp.perl.org/group/perl.module-authors/2009/09/msg7891.html
http://rt.cpan.org/Public/Bug/Display.html?id=32841
https://rt.cpan.org/Public/Bug/Display.html?id=43549
http://jjnapiorkowski.vox.com/library/post/trouble-installing-with-cpan.html

Any user who tries to install modules from CPAN as non-root user on OS X will run into this problem. Apparently it's known since early 2008 ...