An open API service indexing awesome lists of open source software.

https://github.com/yanick/metacpan.js

MetaCPAN jQuery API
https://github.com/yanick/metacpan.js

Last synced: about 2 months ago
JSON representation

MetaCPAN jQuery API

Awesome Lists containing this project

README

        

# MetaCPAN jQuery API

A javaScript API for MetaCPAN.

Right now, this is still a proof of concept and will grow, but...

```



$(function(){

var metacpan = $.metacpan();

// returns a promise, just like $.get()
metacpan.author('YANICK').success(function(data){
alert( data.name );
});

metacpan.module('Dist::Zilla').success(function(data){
alert( data.description );
});

metacpan.release('Dist-Zilla').success(function(data){
alert( data.date );
});

```

## Methods

Note: All methods return promises, just like *jQuery*'s AJAX methods, and not
the queries data directly.

### author( *pause_id* )

Returns information about the given author (see
http://api.metacpan.org/v0/author/_mapping).

```javascript
$.metacpan().author('YANICK').success( function(data){
alert( data.name );
});
```

### module( *module_name* )

Returns information about the given module (see
http://api.metacpan.org/v0/module/_mapping).

```javascript
$.metacpan().module('Dist::Zilla').success( function(data){
alert( data.description );
});
```
### release( *release_name* )

Returns information about the given release (see
http://api.metacpan.org/v0/release/_mapping).

```javascript
$.metacpan().release('Dist-Zilla').success( function(data){
alert( data.date );
});
```

### file( *author*, *release*, *path* )

Returns information about the given file (see
http://api.metacpan.org/v0/file/_mapping).

```javascript
$.metacpan().file('DOY','Moose-2.0001','lib/Moose.pm').success( function(data){
alert( data.distribution );
});
```

## See Also

* The [MetaCPAN API documentation](https://github.com/CPAN-API/cpan-api/wiki/Beta-API-docs), natch.

* The [MetaCPAN explorer](http://explorer.metacpan.org), which provides an easy wayt to play with the requests (alongside good examples).

* [MetaCPAN::API](https://metacpan.org/release/MetaCPAN-API), providing an interface to the MetaCPAN API in perl-space.