blib/lib/Net/MPD/Response.pm

filter: Statementstmt 18.9% 7 / 37 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 18.1% 2 / 11 Podpod 0.0% 0 / 9 totaltotal 13.6% 9 / 66 SCAR 33.2
CC
6
Cov
16%
new
6.0
is_ok
6.0
is_error
6.0
CRAP 27.7
« blib/lib/Net/MPD.pm ↑ Summary Build »
1 package Net::MPD::Response;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 sub new {
7 0 ▶ my ($class, $response, @lines) = @_;
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
8  
9 0 my $self = bless {
10 lines => [ @lines ],
11 };
12  
13 0 ▶ if (my @args = $response =~ /^ACK \[(\d+)@(\d+)\] \{(\w*)\} (.*)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@args) = $response =~ /^ACK \[(\d+)@(\d+)\] \{(\w*)\} (.*)$/) 0 0 0
14 0 $self->{error} = $args[0];
15 0 $self->{line} = $args[1];
16 0 $self->{command} = $args[2];
17 0 $self->{message} = $args[3];
18 };
19  
20 0 return $self;
21 }
22  
23 sub is_ok {
24 0 ▶ my $self = shift;
Subroutine is_ok: not called CC=2 SCAR=17.9
Pod undocumented
25 0 ▶ return $self->{error} ? undef : 1;
Branch: 1 branch
BranchTrueFalseTotal
$self->{'error'} ? : 0 0 0
26 }
27  
28 sub is_error {
29 0 ▶ my $self = shift;
Subroutine is_error: not called CC=2 SCAR=17.9
Pod undocumented
30 0 ▶ return $self->{error} ? 1 : undef;
Branch: 1 branch
BranchTrueFalseTotal
$self->{'error'} ? : 0 0 0
31 }
32  
33 sub error {
34 0 ▶ my $self = shift;
Subroutine error: not called CC=1 SCAR=6.9
Pod undocumented
35 0 return $self->{error};
36 }
37  
38 sub line {
39 0 ▶ my $self = shift;
Subroutine line: not called CC=1 SCAR=6.9
Pod undocumented
40 0 return $self->{line};
41 }
42  
43 sub command {
44 0 ▶ my $self = shift;
Subroutine command: not called CC=1 SCAR=6.9
Pod undocumented
45 0 return $self->{command};
46 }
47  
48 sub message {
49 0 ▶ my $self = shift;
Subroutine message: not called CC=2 SCAR=17.9
Pod undocumented
50 0 ▶ return $self->{message} || '';
Condition0%0/2
$self->{'message'} || ''
l!l
00
MC/DC0%0/1
$self->{'message'} || ''
$self->{'message'}
Truth table0%0/2
A
A= $self->{'message'}
Aresult
11
00
51 }
52  
53 sub lines {
54 0 ▶ my $self = shift;
Subroutine lines: not called CC=1 SCAR=6.9
Pod undocumented
55 0 return @{$self->{lines}};
56 }
57  
58 sub make_hash {
59 0 ▶ my $self = shift;
Subroutine make_hash: not called CC=2 SCAR=17.9
Pod undocumented
60 0 my $hash = {};
61 0 foreach my $line (@{$self->{lines}}) {
62 0 my ($name, $value) = split /: /, $line, 2;
63 0 $hash->{$name} = $value;
64 }
65 0 return $hash;
66 }
67  
68 1 1;
« blib/lib/Net/MPD.pm ↑ Summary Build »