Wednesday, August 03, 2011

perlbrew and 32-bit CPAN modules like Mac::Growl


Today I discovered perlbrew, a utility for managing multiple versions of Perl under a non-root account, in the same spirit as rvm or virtualenv. I was forced into discovering perlbrew, because installing XCode 4 onto a Mac breaks the ability to compile many CPAN modules if you stick with the computer's default Perl.

Even with perlbrew, you might still have trouble compiling CPAN modules on a Mac, if those modules need older 32-bit code. This is because perlbrew doesn't build its perls as fat binaries, it builds them as 64-bit only.

I used perlbrew to install Perl 5.14.1, and then I was trying to install Test::Continuous, which has a long chain of dependencies including Mac::Growl, Mac::Growl itself depending on Mac::Carbon. Mac::Carbon is 32-bit. I was able to work around this, but I had to (temporarily) leave the CPAN shell to do it. The steps are:

  1. Install Cocoa::Growl as a 64-bit alternative to Mac::Growl. You can use the CPAN shell for this.
  2. Install Log::Dispatch::MacGrowl. This module will recognize that you
    have Cocoa::Growl installed, but for some reason it still won't install
    via CPAN shell. But it will install if you download the tarball and build manually.
  3. Now via CPAN install Log::Dispatch::DesktopNotification.
  4. Now via CPAN install Test::Continuous.