blib/lib/Redis/Fast/Sentinel.pm

filter: Statementstmt 35.1% 13 / 37 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 40.0% 4 / 10 Podpod 100% 6 / 6 totaltotal 34.3% 23 / 67 CC 7 SCAR 18.7
CC
7
Cov
27%
get_service_address
12.0
get_service_address
12.0
get_masters
6.0
CRAP 6.5
« builder/MyBuilder.pm ↑ Summary blib/lib/Redis/Fast/Hash.pm »
1 package Redis::Fast::Sentinel;
2  
3 # ABSTRACT: Redis::Fast Sentinel interface
4  
5 42 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 42 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 42 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 42 ▶use base qw(Redis::Fast);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
13 0 ▶ my ($class, %args) = @_;
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
14 # these args are not allowed when contacting a sentinel
15 0 delete @args{qw(sentinels service)};
16 # Do not support SSL for sentinels
17 0 $args{ssl} = 0;
18  
19 0 $class->SUPER::new(%args);
20 }
21  
22 0 ▶sub get_service_address {
Subroutine get_service_address: not called CC=3 SCAR=24.8
Pod documented
23 0 ▶ my ($self, $service) = @_;
Subroutine get_service_address: not called CC=3 SCAR=24.8
Pod documented
24 0 my ($ip, $port) = $self->sentinel('get-master-addr-by-name', $service);
25 0 ▶ defined $ip
Branch: 2 branches
BranchTrueFalseTotal
defined $ip or return 0 0 0
defined $ip or return 0 0 0
26 or return;
27 0 ▶ $ip eq 'IDONTKNOW'
Branch: 2 branches
BranchTrueFalseTotal
$ip eq "IDONTKNOW" and return $ip 0 0 0
$ip eq "IDONTKNOW" and return $ip 0 0 0
28 and return $ip;
29 0 return "$ip:$port";
30 }
31  
32 0 ▶sub get_masters {
Subroutine get_masters: not called CC=2 SCAR=17.9
Pod documented
33 0 ▶ map { +{ @$_ }; } @{ shift->sentinel('masters') || [] };
Subroutine get_masters: not called CC=2 SCAR=17.9
Pod documented
Condition0%0/4
(shift())->sentinel('masters') || []
l!l
00
(shift())->sentinel('masters') || []
l!l
00
MC/DC0%0/1
(shift())->sentinel('masters') || []
(shift())->sentinel('masters')
MC/DC0%0/1
(shift())->sentinel('masters') || []
(shift())->sentinel('masters')
Truth table0%0/2
A
A= (shift())->sentinel('masters')
Aresult
11
00
Truth table0%0/2
A
A= (shift())->sentinel('masters')
Aresult
11
00
34 }
35  
36 42 1;
37  
38 __END__
« builder/MyBuilder.pm ↑ Summary blib/lib/Redis/Fast/Hash.pm »