This is Joshua Wehner's archaic Blog

Me vs. perl, stupid perl

The issue here is long since been resolved. This is a rant, not really a plea for help.

I recently decided that I've been using mbox for too long, it was time to switch to maildir. It looks like mb2md, written in perl, is the tool for the job.

It tells me (in red letters!) that it requires the TimeDate perl library.

"No problem," I says. "That link goes to CPAN, supposedly perl's greatest strength, the reason we should all rally 'round the VM. I can do this!"

Ha. Ha ha ha, ha ha, ha-ha-ha-ha, hahahahahaha.


I found various, completely useless instructions for installing CPAN modules. None of them worked. ("Mirror CPAN? Why the @#$% would I want to do that? I just want to install the @#$%ing module!") You might think "How do I use this thing?" might be a frequently asked quesiton, but it's apparently not.

Maybe I should be more clear: the instructions I found typically assume that I have the module and just need to install it. Not the case. This was typical:

$ perl -MCPAN -e 'install TimeDate'
Warning: Cannot install TimeDate, don't know what it is.
Try the command
    i /TimeDate/
to find objects with matching identifiers.

Okay, let's try that...

$ sudo perl -MCPAN -e 'i /TimeDate/'
syntax error at -e line 1, at EOF
Execution of -e aborted due to compilation errors.

Hrmmm. Let's try that shell thing:

cpan> i /TimeDate/
Distribution id = G/GB/GBARR/TimeDate-1.16.tar.gz...

Er? So, it can find it, it just doesn't want to?

I said at the outset that this was resolved, but only the immediate issue is settled (I found an Ubuntu package that provided the perl modules as dependencies) but not the underlying issue: I still have zero confidence that I'd be able to install a perl module in the future. Stupid perl.

You know how easy it is to install (most) Ruby gems (the Ruby equivalent of CPAN) ?

sudo gem install NAME


Stupid perl.

Permalink • Posted in: perl, tech stuffComments (2)


Chris Dolan Jun 8, 2007

Actually, this is an error by the TimeDate author, Graham Barr. The problem is that CPAN installs by module name. Graham made the unwise choice to name his distribution something other than the name of a module. If you look at the TimeDate page, you can see that there is no module named TimeDate in that distribution, contrary to all CPAN advice. Try this instead:

sudo cpan install Date::Format

In truth, TimeDate is deprecated and it's unfortunate that mb2md uses it. Instead, the CPAN community has standardized on instead, which is fantastic and thorough.

If Graham had bothered to simply add a file to his distribution, you would not have had any problems... Graham maintains some of the most important and, unfortunately, quirkiest and poorly-named modules on CPAN.

Joshua Jun 8, 2007

Hmm. Fair enough, I guess. I suppose I don't understand enough of CPAN inner workings to even express this properly, but even that seems more than a little wonky to me.

Is there a reason that distribution name and module name wouldn't be the same? Or, if CPAN installs by module name, why use the distribution name at all? Maybe there's a subtley here that I'm just not seeing.