line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Spotify::Service; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
23
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
95
|
|
4
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
69
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
25
|
use Carp (); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
58
|
|
7
|
3
|
|
|
3
|
|
15443
|
use LWP::UserAgent (); |
|
3
|
|
|
|
|
3562528
|
|
|
3
|
|
|
|
|
84
|
|
8
|
3
|
|
|
3
|
|
38
|
use URI (); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
45
|
|
9
|
3
|
|
|
3
|
|
2876
|
use URI::QueryParam (); |
|
3
|
|
|
|
|
4175
|
|
|
3
|
|
|
|
|
1694
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
14
|
2
|
|
|
2
|
1
|
39
|
my $class = shift; |
15
|
2
|
|
50
|
|
|
24
|
$class = ref $class || $class || __PACKAGE__; |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
|
|
30
|
my $self = { |
18
|
|
|
|
|
|
|
ua => LWP::UserAgent->new( |
19
|
|
|
|
|
|
|
agent => 'Net::Spotify/' . $VERSION, |
20
|
|
|
|
|
|
|
env_proxy => 1, |
21
|
|
|
|
|
|
|
), |
22
|
|
|
|
|
|
|
base_url => 'http://ws.spotify.com', |
23
|
|
|
|
|
|
|
version => '1', |
24
|
|
|
|
|
|
|
format => 'xml', |
25
|
|
|
|
|
|
|
}; |
26
|
|
|
|
|
|
|
|
27
|
2
|
|
|
|
|
77676
|
bless $self, $class; |
28
|
|
|
|
|
|
|
|
29
|
2
|
|
|
|
|
16
|
return $self; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub base_url { |
33
|
10
|
|
|
10
|
1
|
6097
|
my $self = shift; |
34
|
|
|
|
|
|
|
|
35
|
10
|
|
|
|
|
68
|
return $self->{base_url}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub format { |
39
|
7
|
|
|
7
|
1
|
13
|
my $self = shift; |
40
|
|
|
|
|
|
|
|
41
|
7
|
|
|
|
|
34
|
return $self->{format}; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub format_request { |
45
|
0
|
|
|
0
|
1
|
0
|
Carp::croak('format_request() is not implemented.'); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub make_request { |
49
|
0
|
|
|
0
|
1
|
0
|
my ($self, @parameters) = @_; |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
0
|
my $request = $self->format_request(@parameters); |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
0
|
my $ua = $self->ua(); |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
0
|
my $response = $ua->request($request); |
56
|
|
|
|
|
|
|
|
57
|
0
|
0
|
|
|
|
0
|
if ($response->is_success) { |
58
|
0
|
|
|
|
|
0
|
return $response->content; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
else { |
61
|
0
|
|
|
|
|
0
|
return $response->status_line; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub ua { |
66
|
2
|
|
|
2
|
1
|
7
|
my $self = shift; |
67
|
|
|
|
|
|
|
|
68
|
2
|
|
|
|
|
141
|
return $self->{ua}; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub version { |
72
|
10
|
|
|
10
|
1
|
23
|
my $self = shift; |
73
|
|
|
|
|
|
|
|
74
|
10
|
|
|
|
|
46
|
return $self->{version}; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__END__ |