Spotify/Service.pm

filter: Statementstmt 80.4% 33 / 41 Branchbran 0.0% 0 / 2 Conditioncond 40.0% 2 / 5 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 84.6% 11 / 13 Podpod 100% 7 / 7 totaltotal 75.7% 53 / 70 CC 4 SCAR 7.5
CC
4
Cov
73%
make_request
6.0
new
3.2
format_request
2.0
CRAP 2.1
« Spotify/Search.pm ↑ Summary Spotify.pm »
1 package Net::Spotify::Service;
2  
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 ▶use LWP::UserAgent ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 ▶use URI ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9 4 ▶use URI::QueryParam ();
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 4 our $VERSION = '0.03';
12  
13 2 ▶sub new {
Subroutine new: called CC=3 SCAR=11.8
Pod documented
14 2 my $class = shift;
15 2 ▶ $class = ref $class || $class || __PACKAGE__;
Condition40%2/5
ref $class || $class || __PACKAGE__
l!l
20
ref $class or $class
l!l&&r!l&&!r
020
MC/DC0%0/2
ref $class || $class || __PACKAGE__
ref $class $class
Truth table33%1/3
A or B
A= ref $classB= $class
ABresult
1X1
011
000
16  
17 2 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 bless $self, $class;
28  
29 2 return $self;
30 }
31  
32 10 ▶sub base_url {
Subroutine base_url: called CC=1 SCAR=0.0
Pod documented
33 10 my $self = shift;
34  
35 10 return $self->{base_url};
36 }
37  
38 7 ▶sub format {
Subroutine format: called CC=1 SCAR=0.0
Pod documented
39 7 my $self = shift;
40  
41 7 return $self->{format};
42 }
43  
44 0 ▶sub format_request {
Subroutine format_request: not called CC=1 SCAR=6.9
Pod documented
45 0 Carp::croak('format_request() is not implemented.');
46 }
47  
48 0 ▶sub make_request {
Subroutine make_request: not called CC=2 SCAR=17.9
Pod documented
49 0 my ($self, @parameters) = @_;
50  
51 0 my $request = $self->format_request(@parameters);
52  
53 0 my $ua = $self->ua();
54  
55 0 my $response = $ua->request($request);
56  
57 0 ▶ if ($response->is_success) {
Branch: 1 branch
BranchTrueFalseTotal
if ($response->is_success) { } 0 0 0
58 0 return $response->content;
59 }
60 else {
61 0 return $response->status_line;
62 }
63 }
64  
65 2 ▶sub ua {
Subroutine ua: called CC=1 SCAR=0.0
Pod documented
66 2 my $self = shift;
67  
68 2 return $self->{ua};
69 }
70  
71 10 ▶sub version {
Subroutine version: called CC=1 SCAR=0.0
Pod documented
72 10 my $self = shift;
73  
74 10 return $self->{version};
75 }
76  
77 4 1;
78  
79 __END__
« Spotify/Search.pm ↑ Summary Spotify.pm »