A couple of years of not doing much Perl, and then coming back to it relatively fresh, is pretty eye-opening. Today I got some insight into what Perl is like for people who haven’t been doing it for years, and perhaps some understanding of why Perl doesn’t seem to be making many new converts.
I decided I was going to update one of my CPAN modules, the woefully unmaintained Metaweb.pm. I set out to do this on my work machine: a Macbook running OS X 10.5.5 (Leopard), on which I’d never done any serious Perl development before.
I started by checking out my code from my own repository. I was sure I’d need some stuff installed from CPAN, so I started by attempting to run the
Build.PL that comes with my own module. It told me it needed a pre-requisite library (JSON), so I ran
cpan install JSON.
Several hundred lines of text scrolled by, and it told me it couldn’t install anything. I dug back a fair way through a lot of non-specific “make failed” before I found anything approximating a meaningful error message: “Perl v5.10.0 required–this is only v5.8.8″. Fair enough. I need to upgrade my Perl. How do I do that on OSX? Well, I’m not sure, but I heard that perl.org had recently had a highly-acclaimed makeover, so I decided to check there. It tells me that Perl is included in Mac OS X. Yes, thanks. And upgrades? I couldn’t find binaries anywhere via the site.
A google for “perl 5.10 on osx” led me to perl.com’s download page which tells me:
If you want to upgrade, you can build the Unix source if you have the developer tools installed.
Luckily I happen to know that “the developer tools” means XCode, which provides such tools as
Hang on… wait a minute… how come I got so far without even having
make installed? Surely the CPAN install script should have bailed out if there was no
make? In retrospect, I realised that I’d just pounded blithely on the enter key while CPAN was configuring, and no doubt had skipped past the bit that asked me where my
make was. I deleted my
~/cpan/CPAN/MyConfig.pm and ran through it again. Yup, sure enough, there was a warning. A single line, plain text warning, that I didn’t notice as it scrolled by.
Now, perhaps I’m just being picky here, but I’d expect that if there’s no
make, it should fail a bit more loudly than that. But whatever. I went to download XCode, noting as I did so that nowhere had any error message or webpage actually provided a URL for where to get that, or even mentioned the name of it. Just so you know, here’s the XCode for OSX 10.5 Leopard download (binary file).
It takes me about 15 minutes to download the almost 1GB XCode via work’s network connection, but had I been at home, or worse yet back in Australia, it might have taken me hours. (It also comes on the Leopard install disks, but I don’t have them handy.) It was long enough for me to write this blog post up to this point, and if I hadn’t been fairly dedicated to getting the job done by now, I probably would have given up by now.
Another 20 minutes to install the package (during which I bitched to friends on IM), and I have
make. I run
cpan install JSON again and everything succeeds. There are 1,988 lines of output, of which many hundreds are Date::Manip’s file listing. Why do I need Date::Manip? I don’t even know, but that doesn’t stop it vomiting gibberish all over my screen.
Anyway, at long last I have the pre-req libraries I need to play with the simple, non-binary package I wrote two years ago. It took me a little over an hour in total.
Oh, and by the way, I didn’t need to upgrade to Perl 5.10 — I guess that was a red herring.
So, these are the things I think the maintainers of the CPAN module, and of various high-profile Perl websites, and of Perl itself, should be doing:
- Fail louder at configuration time if vital CPAN install tools aren’t available.
- Fail louder at module install time, ditto.
- Suppress about 90% of CPAN output unless a verbose flag is set, to make it easier to see warnings etc.
- Provide links to required developer tools (i.e. XCode, for OSX) in warnings, on webpages, etc.
- Provide a binary package of recent versions of Perl for recent versions of OSX.
Some of these I can do something about, some I can’t. I’ll go nag the right people after I post this, and see if I can get things moving, write some patches, or something. But why are we even in this situation? CPAN has got hairier and hairier over the last, say, five to seven years, to the point where it is a serious impediment to anyone starting Perl development. If you are an experienced developer, you probably don’t notice it anymore, but trust me: I’d been doing Perl for a decade and been publishing modules to CPAN for eight years before I took two years off, and I found this intensely frustrating. For new developers on anything other than a traditional(ish) Unix system on which they have root (and that includes most web hosting providers), CPAN — which was meant to simplify Perl development — is undoubtedly a major barrier to entry.
This needs fixing.