WebService::Lastfm - interact with Last.fm's API
my $lastfm = WebService::Lastfm.new(:api-key<1234>, :api-secret<music>);
# Read request
say $lastfm.request('user.getInfo', :user<avuserow>);
# Update now playing
:artist("Alan Parsons Project"),
Bindings for Last.fm's API using the JSON format (instead of their default
XML). You must register for their API to get an API key and API secret.
Standard new method. All parameters are optional, but the API key is needed for
all known requests, and the secret is needed for write methods.
Make an unsigned GET request, used for read-only operations.
Make a signed POST request, used for writing operations, the most famous of
which is "scrobbling" (track.scrobble).
X::WebService::Lastfm is thrown on any error responses, with the decoded error
message from Last.fm. Check the method's documentation (or the API
documentation overall) for the meaning of the code.
- No packaged tests -- testing things that require API keys is nontrivial
- The assumption about requests being either GET/unsigned or POST/signed may
not be true, in which case more methods may be needed.
- Undertested in general
- Switch to HTTP::UserAgent, which needs work to implement this
- Add tests somehow
- Example scripts. Ideas include a history exporter and a CLI scrobbler
- Optional caching mode
- Some sort of pagination helper for some API calls
- Rakudo Perl 6
Last.fm's API documentation