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.

2 comments:

gugod said...

Log-Dispatch-MacGrowl does not install probably smoothly probably because it contains both Build.PL and Makefile.PL and they really specify different dependencies. Makefile.PL only specify Mac::Growl.

BTW I think Growl::Any installation should be less pain. On a clean system whiteout any perl modules installed, you can install Growl::Any first, and then Cocoa::Growl to make it work. No need to figure out the dependency ordering.

gugod said...

Forgot to mention: I also want to use Growl::Any in Log::Dispatch::DesktopNotification instead of the semi-broken Mac::Growl. If you're interested in helping, find the repo on github and send me a pull request anytime :)