MetaCPAN JavaScript API

Posted in: Technical Track

Sometimes, it’s humongous revolutions. Most of the time, it’s itsy bitsy evolutionary steps. Today’s hack definitively sits in the second category, but I have the feeling that it’s a little dab of abstraction that is going to provide a lot of itch relief.

You see, MetaCPAN does not only have a pretty face, but also has a smashing backend that can be used straight-up for fun and profit.

Accessing REST endpoints is not hard, but it’s a little bit of a low-level chore. In Perl space, there is already MetaCPAN::API to abstract.

[perl] my $ua = LWP::UserAgent;
my $me = decode_json(
$ua->get( ‘’


[perl] my $mcpan = MetaCPAN::API;
my $me = $mcpan->author(‘YANICK’);

In JavaScript-land? Well, there was jQuery, of course:

[javascript]$.get(‘’).success( function(data) {
alert( ‘hi there ‘ + );

But now there is also metacpan.js:

[javascript]$.metacpan().author(‘YANICK’).success( function(data) {
alert( ‘hi there ‘ + );

The plugin is still very simple and only implements author(), module(), release(), and file(). And each of these methods is nothing but a glorified wrapper around the underlying $.ajax() calls. But then again, isn’t the road to heaven paved with glorified wrappers? (Which could be more of an indication of the terrible littering habits of angels than anything else, mind you.)

Enjoy (and/or fork, depending on how much the current code is already scratching your own itch)!

Want to talk with an expert? Schedule a call with our team to get the conversation started.

No comments

Leave a Reply

Your email address will not be published. Required fields are marked *