Skip to content

Commit

Permalink
it might be a module
Browse files Browse the repository at this point in the history
  • Loading branch information
st3vil committed Nov 7, 2011
1 parent 85266db commit 94b5c27
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 31 deletions.
6 changes: 6 additions & 0 deletions Changes
@@ -0,0 +1,6 @@
Revision history for Perl extension Net::LastFMAPI.

0.1 Tue Nov 8 01:04:46 2011
- original version; created by h2xs 1.23 with options
-AX Net::LastFMAPI

6 changes: 6 additions & 0 deletions MANIFEST
@@ -0,0 +1,6 @@
Changes
Makefile.PL
MANIFEST
README
t/Net-LastFMAPI.t
lib/Net/LastFMAPI.pm
12 changes: 12 additions & 0 deletions Makefile.PL
@@ -0,0 +1,12 @@
use 5.010001;
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
NAME => 'Net::LastFMAPI',
VERSION_FROM => 'lib/Net/LastFMAPI.pm', # finds $VERSION
PREREQ_PM => {}, # e.g., Module::Name => 1.1
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT_FROM => 'lib/Net/LastFMAPI.pm', # retrieve abstract from module
AUTHOR => 'steve <steve@>') : ()),
);
33 changes: 19 additions & 14 deletions README
@@ -1,24 +1,29 @@
README for Net::LastFMAPI
=========================
Net-LastFMAPI version 0.01
==========================

Functions for interacting with the LastFM API version 2.0.

Installing
----------
The application is designed to be installed like a CPAN module; so use
the usual:
INSTALLATION

perl Makefile.PL
make
sudo make install
To install this module type the following:

The CPAN module dependencies will be highlighted during the first
command. If you do not have 'sudo' installed, you can use:
perl Makefile.PL
make
make test
make install

su root -c make install
DEPENDENCIES

This module requires these other modules and libraries:

LWP::UserAgent
Digest::MD5
JSON::XS
File::Slurp
File::Path

COPYRIGHT AND LICENCE

License and credits
-------------------
Copyright (c) 2011, Steev Eeeriumn. All Rights Reserved.
This module is free software. It may be used, redistributed
and/or modified under the terms of the Perl Artistic License
Expand Down
53 changes: 36 additions & 17 deletions lib/Net/LastFMAPI.pm
Expand Up @@ -12,7 +12,7 @@ use Exporter 'import';
our @EXPORT = ('lastfm');
use Carp;

our $VERSION = 0.4;
our $VERSION = 0.1;
our $url = 'http://ws.audioscrobbler.com/2.0/';
our $api_key = 'dfab9b1c7357c55028c84b9a8fb68880';
our $secret = 'd004c86dcfa8ef4c3977b04f558535f2';
Expand Down Expand Up @@ -342,36 +342,55 @@ Makes requests to http://ws.audioscrobbler.com/2.0/ and returns the result.
Takes care of POSTing to write methods, doing authorisation when needed.
Dies upon error.
Dies if something went obviously wrong.
Will create an authorised session when needed, so unless you alter the subroutine
B<talk_authentication> it will print instructions to visit a link in your browser
to authorise itself with whoever is logged in.
=head1 THE SESSION KEY
After creating that session it is saved in the symlink
B<$ENV{HOME}/.net-lastfmapi-sessionkey>, you could alter B<load_save_sessionkey>
to make this happen another way.
$Net::LastFMAPI::session_key = "secret"
Setting B<$Net::LastFMAPI::json> to a true value will automatically add
B<format =E<gt> "json"> to every request AND decode the result into perl data for you.
Not all methods support JSON.
It will be sought when an authorised request is needed.
If it is not saved then on-screen instructions should be followed to authorise
with whoever is logged in to L<last.fm>.
It is saved in the symlink B<$ENV{HOME}/.net-lastfmapi-sessionkey>. This is
probably fine.
Consider altering the subroutines B<talk_authentication>, B<load_save_sessionkey>,
or simply setting the B<$Net::LastFMAPI::session_key> before needing it.
=head1 RETURN PERL DATA
$Net::LastFMAPI::json = 1
This will automatically add B<format =E<gt> "json"> to every request B<and decode
the result> into perl data for you.
Not all methods support JSON. Beware of "@attr" and empty elements turned into
whitespace strings instead of empty arrays.
=head1 CACHING
$Net::LastFMAPI::cache = 1
$Net::LastFMAPI::cache_dir = "$ENV{HOME}/.net-lastfmapi-cache/"
Does caching. Default cache directory is shown. Good for development.
=head1 SEE ALSO
L<Net::LastFM> doesn't handle sessions for you, won't POST to write methods
These are for the 1.2 API which is deprecated and I had no luck with them:
L<WebService::LastFM>
L<Music::Audioscrobbler::Submit>
L<Net::LastFM::Submission>
I had no luck with the 1.2 API modules: L<WebService::LastFM>,
L<Music::Audioscrobbler::Submit>, L<Net::LastFM::Submission>
=head1 BUGS/CODE
L<https://github.com/st3vil/net-lastfmapi>
L<https://github.com/st3vil/Net-LastFMAPI>
=head1 AUTHOR
Steev Eeeriumn
Steev Eeeriumn <nostrasteve@gmail.com>
=head1 COPYRIGHT
Expand Down
File renamed without changes.

0 comments on commit 94b5c27

Please sign in to comment.