Several Small Bits of News

A few little bits and pieces, none of which justify a blog post to themselves.

blogs.perl.org

Some of you will have seen that Evozon’s grant to replace blogs.perl.org was cancelled a couple of months ago. This made me sad as I (along with the rest of the blogs.perl.org team) really want to see the current, fragile, set-up replaced as soon as possible.

I’m happy to see that a new grant proposal has been received from a team at Booking.com. They want to take Evozon’s work, along with some other improvements that they’ve made in house and complete the project.

I’d really like to see this grant approved and the project completed. Please feel free to add your comment to the proposal.

Perl News

Who remembers use.perl.org? For many years it was the best place to go for both Perl news and Perl blogs. The idea behind blogs.perl.org was to replace the blogging part of that site and a few years ago, Leo Lapworth and I built perlnews.org to replace the other part of the equation.

Unfortunately, neither of us really had the time to invest in the site and it never really took off. These days there are plenty of other places to get your Perl news, so we’ve taken the decision to close the site down. The existing stories will remain online and I might replace the current WordPress installation with a static site at some point in the future.

The Perl Conference in Amsterdam

A couple of my recent blog posts have been about deciding what training course to run alongside The Perl Conference (The Conference Formerly Known As YAPC Europe) in Amsterdam.

Unfortunately, my plans had a big collision with Real Life and I’ve realised that it’s just unrealistic for me to have enough time to prepare for the conference. So, sadly, I’ve made the decision that I won’t be in Amsterdam this August.

I’m sure it’ll be a great conference though and I wish the organisers the best of luck with it.

Web Application Development in Perl 6

Gabor asked me to give him a quotation explaining why I had backed his Indiegogo campaign to write a book on web development with Perl 6. This is what I sent him:

I’ve been largely ignoring Perl 6 development since the project started in 2000. I figured that I would have plenty of chance to catch up with it before clients started expecting me to know it. The official release of Perl 6 eighteen months ago means that the time is now right for me to start taking an interest. A lot of the code I write drives web sites, so I want to get up to speed with web development in Perl 6 quickly. That’s why I supported this crowdfunding campaign – I want to read this book and I think that Gabor is the right person to write it.

I think this will be a very useful book. You might consider backing it too.

CPAN Badges

I’m a big fan of the badges from shields.io. I use their CPAN badge on my dashboard. Unfortunately, this badge has stopped working – it just says “cpan | invalid”.

I did some investigation and discovered this was because they use the MetaCPAN v0 API – which has now been switched off. It was simple enough to patch the code to use the v1 API. I’ve sent them a pull request, but it hasn’t been accepted yet.

Give Me MetaCPAN

Ever since MetaCPAN launched I’ve been getting increasingly irritated with people who still use links to search.cpan.org. Isn’t it obvious that MetaCPAN is better? Why do people still insist on sharing links to the older site?

Of course they do it for various reasons. Perhaps they aren’t as in touch with the modern Perl world as I am. Perhaps they are wary about changing to use the new shiny toys because they know that a newer shinier one will be along soon. Perhaps I’m reading a web page from five years ago and they can be forgiven for not linking to a site that didn’t exist at the time.

Eventually I realised that there was no point in getting annoyed. I had a computer. Surely I could do something that would fix this problem.

My first idea was to write a GreaseMonkey script. Then I realised that would be hard. MetaCPAN and CPAN have slightly different URL schemes. I’d need to recognise a CPAN URL and convert it to the equivalent MetaCPAN URL. Not an impossible task at all, but not something I could knock up in an hour or so. Especially not in Javascript.

So I asked on the #metacpan IRC channel. Surely I couldn’t be the first person to have this problem. And someone there introduced me to mcpan.org. There’s no point in clicking on that link. You’ll just end up on MetaCPAN. Because that’s what mcpan does. It’s a URL rewriting service. You give it a CPAN URL (with the cpan.org changed to mcpan.org) and it redirects you to the equivalent page on MetaCPAN.

That’s the hard bit of the problem. The bit I didn’t want to write. And someone else has already written it. But they seem to have kept it very quiet. This deserves more publicity. I wish I could remember who wrote it. If you know, please leave a comment.

So we’re now most of the way there. Now if I click on a CPAN link, I can just edit the location bar to add an ‘m’ and I’ll be redirected to the right place. But we can do better than that. I’d like to be automatically redirected. That’s when I discovered the Redirector extension for Firefox. Once it’s installed you can configure it to redirect certain URLs to other ones. I have it configured so that http://search.cpan.org* redirects to http://mcpan.org$1. See how you can use wildcards to match URLs and then use whatever they matched in the replacement URL. It’s a lot like regexes in Perl.

And we’re done. Now whenever I click on an old-style CPAN link, I’m automatically redirected to mcpan, And that, in turn, redirects me to MetaCPAN. And, best of all, I didn’t have to write any code. It was just a case of putting together tools that already existed.

I did all this a few months ago. I meant to write this blog post at the time, but I forgot. I was reminded this morning when Chisel mentioned a GreaseMonkey script he had written to do all of this. See, Chisel isn’t afraid of parsing URLs in Javascript like I was. He just went ahead and did it.

But having alternative solutions to the problem is good, right?

Update: I’ve just been talking about this on the #metacpan IRC channel and it seems that I was rather misunderstanding what was going on here. Here are the details.

Firstly, it was dpetrov who told me about mcpan.org. It’s his domain. I asked him for the code, and he pointed out that there is no code. mcpan.org just redirects everything to a domain called sco.metacpan.org which is where the magic happens. He just got tired of editing search.cpan.org to sco.metacpan.org so he registered another, simpler, domain.

So the actual cleverness happens over on sco.metacpan.org. And that’s really just a list of rewrite rules (the code is on github). I say “just”, but I still wouldn’t want to write them myself.

All this means that mcpan,org is only a convenient tool for when you’re manually editing your location bar. When you’re using the Redirector extension for Firefox you can miss out the middle man and redirect straight to sco.metacpan.org. So I’ve updated my Redirector rule appropriately.