Branch Coverage

blib/lib/Redis.pm
Criterion Covered Total %
branch 53 254 20.8


line true false branch
49 0 2 unless $socket
51 0 2 unless defined $self->{'read_timeout'} or defined $self->{'write_timeout'}
54 2 0 if defined $self->{'read_timeout'}
56 0 2 if defined $self->{'write_timeout'}
68 0 0 if ($ENV{'REDIS_SERVER'} and not defined $args{'sock'} and not defined $args{'server'} and not defined $args{'sentinels'})
69 0 0 if ($ENV{'REDIS_SERVER'} =~ m[^/]) { }
0 0 elsif ($ENV{'REDIS_SERVER'} =~ /^unix:(.+)/) { }
0 0 elsif ($ENV{'REDIS_SERVER'} =~ /^(?:tcp:)?(.+)/) { }
90 0 2 if (defined $args{'sock'}) { }
0 2 elsif ($args{'sentinels'}) { }
97 0 0 $self->{'cnx_timeout'} ? :
104 0 0 unless ref $self->{'sentinels'} eq "ARRAY"
108 0 0 unless defined($self->{'service'} = $args{'service'})
115 0 0 unless my $sentinel = eval { do { "Redis::Sentinel"->new("server", $sentinel_address, "cnx_timeout", defined $self->{'sentinels_cnx_timeout'} ? $self->{'sentinels_cnx_timeout'} : "0.1", "read_timeout", defined $self->{'sentinels_read_timeout'} ? $self->{'sentinels_read_timeout'} : 1, "write_timeout", defined $self->{'sentinels_write_timeout'} ? $self->{'sentinels_write_timeout'} : 1) } }
123 0 0 defined $self->{'sentinels_cnx_timeout'} ? :
0 0 defined $self->{'sentinels_read_timeout'} ? :
0 0 defined $self->{'sentinels_write_timeout'} ? :
127 0 0 unless defined $server_address
130 0 0 if $server_address eq "IDONTKNOW"
137 0 0 unless ($self->{'no_sentinels_list_update'})
158 0 0 $self->{'cnx_timeout'} ? :
161 0 0 if (exists $args{'ssl'} and $args{'ssl'}) { }
176 2 0 defined $args{'server'} ? :
184 0 2 $self->{'cnx_timeout'} ? :
187 2 0 if (exists $args{'ssl'} and $args{'ssl'}) { }
210 2 0 unless $args{'no_auto_connect_on_new'}
221 0 0 unless defined $database
224 0 0 if (not defined $self->{'current_database'} or $self->{'current_database'} ne $database)
258 0 2 @_ && ref $_[-1] eq 'CODE' ? :
266 0 2 if ($uc_command eq 'MULTI') { }
0 2 elsif ($uc_command eq 'EXEC' or $uc_command eq 'DISCARD') { }
0 2 elsif ($uc_command eq 'WATCH') { }
0 2 elsif ($uc_command eq 'UNWATCH') { }
279 2 0 unless $self->{'reconnect'}
294 0 0 unless $self->{'reconnect'}
299 0 0 unless ref $_ eq "Redis::X::Reconnect"
303 0 0 if $self->{'__inside_transaction'} or $self->{'__inside_watch'}
305 0 0 unless $self->{'queue'}
306 0 0 if scalar @{[] unless $self->{'queue'};} and $self->{'conservative_reconnect'}
327 0 2 $cb && $custom_decode ? :
332 0 2 if $cb
336 0 1 wantarray && ref $ret eq 'ARRAY' ? :
0 1 $custom_decode ? :
354 0 2 unless $handler
366 0 0 unless $self->{'sock'}
368 0 0 if @_ and ref $_[-1] eq "CODE"
385 0 0 if @_ and ref $_[-1] eq "CODE"
388 0 0 unless $self->{'sock'}
392 0 0 unless $self->__close_sock
401 0 0 if @_ and ref $_[-1] eq "CODE"
404 0 0 unless defined $self->{'sock'}
422 0 0 if not defined $reply or ref $reply
426 0 0 @_ && ref $_[-1] eq 'CODE' ? :
430 0 0 unless $self->{'reconnect'}
448 0 0 if defined $reply and not ref $reply
450 0 0 ref $reply && ($synchronous_scalar || wantarray) ? :
453 0 0 @_ && ref $_[-1] eq 'CODE' ? :
457 0 0 unless $self->{'reconnect'}
491 0 0 unless defined $has_stuff
496 0 0 if (not $self->{'ssl'}) { }
512 0 0 if defined $error
526 0 0 if defined $e and $e ne "EOF from server"
539 0 0 unless ref $cb eq "CODE"
548 0 0 unless $self->{'sock'}
550 0 0 if $unsub
552 0 0 unless @subs
575 0 0 if @$cbs
590 0 0 if defined $error
593 0 0 if ($m->[0] =~ /^p?message$/)
602 0 0 unless $unsub
615 0 0 defined $m->[2] ? :
617 0 0 unless (defined $subs->{$cbid})
634 0 2 if $self->{'is_subscriber'}
652 2 0 unless $self->{'reconnect'}
662 0 0 unless $@
663 0 0 if Time::HiRes::tv_interval($t0) > $self->{'reconnect'}
678 0 2 if (defined $self->{'password'})
697 0 1 unless defined $self->{'sock'}
707 2 0 unless ($self->{'is_subscriber'})
711 0 0 if ref $n eq "CODE"
712 0 0 if defined $n
713 0 2 if defined $self->{'name'}
718 0 2 if defined $self->{'current_database'}
722 0 0 if ($topic =~ /(p?message):(.*)$/)
724 0 0 if ($key eq 'message') { }
727 0 0 if defined $error
732 0 0 if defined $error
739 0 2 if defined $self->{'on_connect'}
750 0 2 if ($self->{'sock'} and ($self->{'pid'} || 0) != $$)
757 0 2 if $deb
764 0 4 unless utf8::downgrade($bin, 1)
766 4 0 defined $bin ? :
772 0 2 unless defined $status
776 0 2 if $deb
779 0 2 unless defined $len
790 0 2 unless $self->{'sock'}
795 2 0 unless $self->{'debug'}
807 0 1 if ($type eq '-') { }
1 0 elsif ($type eq '+' or $type eq ':') { }
0 0 elsif ($type eq '$') { }
0 0 elsif ($type eq '*') { }
814 0 0 if $result < 0
818 0 0 if $result < 0
823 0 0 if ($collect_errors) { }
827 0 0 if defined $nested[1]
843 1 1 unless (defined $data)
851 0 1 if $self->{'debug'}
862 0 2 if (length $$buf)
864 0 0 if $idx >= 0
869 0 2 if not defined $bytes and $! == 4
870 1 1 unless defined $bytes and $bytes
876 1 0 if $idx >= 0
885 0 0 if ($buflen < $len)
889 0 0 if not defined $bytes and $! == 4
890 0 0 unless defined $bytes
891 0 0 unless $bytes
898 0 0 if $self->{'debug'}
912 0 2 if (&WIN32()) { }
918 2 0 if ($self->{'ssl'}) { }
932 0 2 if (defined $res)
934 0 0 if (length $data)
935 0 0 unless $self->{'ssl'}
943 0 2 if $err and $err == 4
946 2 0 if $err and $err == 11 || $err == 11
950 0 0 if $err and $err == 104
953 0 0 if $err == 0
970 0 0 if $self->{'reconnect'}