package WWW::Deezer;
use strict;
use warnings;
use Carp();
use LWP::UserAgent;
use JSON;
use URI::Escape;
use WWW::Deezer::SearchResult;
use WWW::Deezer::Artist;
our $VERSION = '0.03';
our $API_VE
rl => "http://api.deezer.com/$API_VERSION/",
ua => LWP::UserAgent->new,
json => JSON->new->allow_nonref,
debug => 0,
};
$self->{ua}->agent("WWW::Deezer v".$V
_get_url ({
url => $uri.'/'.$id,
method => 'GET'
});
$res = $self->{json}->decode ($res) unless _is_hashref ($res);
$res->{deezer_obj} = $self;
return WWW::Deeze
a => 'Int';
has 'nb_fan', is => 'rw', isa => 'Int';
has 'radio' => (
is => 'ro',
isa => 'JSONBoolean',
coerce => 1
);
around BUILDARGS => sub { # allow create Artist object with single a
$self = WWW::Deezer->new->artist($_[0]);
}
else {
# 2DO: deal with Bool and JSON::XS::Boolean=\1 in 'radio' argument
$self = $class->$orig(@_);
}
return $self;
};
;
# base class for representing Deezer objects
subtype 'JSONBoolean' => (as 'Int');
coerce 'JSONBoolean' => (
from 'Ref',
via { JSON::is_bool($_) }
);
subtype 'Url' => as 'Str',
where