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
- Host: GitHub
- URL: https://github.com/yanick/metacpan.js
- Owner: yanick
- Created: 2013-03-29T17:09:54.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2013-04-16T00:53:00.000Z (about 12 years ago)
- Last Synced: 2025-02-15T23:41:14.957Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 164 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.mkd
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.