Building simplicidade.org: notes, projects, and occasional rants

Tip: homebrew, old groff and perldoc

With recent perl's, the perldoc command started spouting warnings about an antiquated groff on OS X (both 10.6.8 and 10.8.0):

You have an old groff. Update to version 1.20.1 for good Unicode support. If you don't upgrade, wide characters may come out oddly.

Given that I already have homebrew to fix all my UNIX desires, I promptly executed brew install groff to fix this. You might need to brew tap homebrew/dupes before, given that groff is already included on the base system.

After a couple of minutes (and, on Mountain Lion, an extra brew install --default-names gnu-sed because system sed complains about sed: RE error: illegal byte sequence; you can brew unlink gnu-sed afterwards to revert to system sed), I had my new groff.

But now a new error message awaited me:

Error while formatting with Pod::Perldoc::ToMan: open3: exec of /Users/melo -man -Kutf8 -Tutf8 /.homebrew/bin/groff failed at /Users/melo/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2/Pod/Perldoc/Toman.pm line 327.

Notice the command Pod::Perldoc::ToMan is trying to execute mixes parameters with the command path.

The problem lies with Pod::Perldoc::ToMan. At some point it decides that it should use groff -man -Kutf8 -Tutf8 as my renderer, and it figure out that my groff is inside my local homebrew install (under /Users/melo/.homebrew, notice the .homebrew). Eventually this command is splitted into command and parameters (at line 301 of ToMan.pm, version 3.17 to be exact) and that is where the problems lies: the regexp used doesn't support dots (.) in the pathname, like my .homebrew and splits at the wrong place.

I've already sent a pull request to fix this, and it was accepted and merged into the distribution, so the next version will work fine. In the meantime, if you come across this problem, you can just hand patch your Pod::Perldoc::ToMan file like I did.