Branch Coverage

blib/lib/Redis.pm
Criterion Covered Total %
branch 55 260 21.1


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, "username", $self->{'sentinels_username'}, "password", $self->{'sentinels_password'}, "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, "ssl", defined $self->{'sentinels_ssl'} ? $self->{'sentinels_ssl'} : 0) } }
127 0 0 defined $self->{'sentinels_cnx_timeout'} ? :
0 0 defined $self->{'sentinels_read_timeout'} ? :
0 0 defined $self->{'sentinels_write_timeout'} ? :
0 0 defined $self->{'sentinels_ssl'} ? :
131 0 0 unless defined $server_address
134 0 0 if $server_address eq "IDONTKNOW"
141 0 0 unless ($self->{'no_sentinels_list_update'})
162 0 0 $self->{'cnx_timeout'} ? :
165 0 0 if (exists $args{'ssl'} and $args{'ssl'}) { }
186 2 0 defined $args{'server'} ? :
194 0 2 $self->{'cnx_timeout'} ? :
197 2 0 if (exists $args{'ssl'} and $args{'ssl'}) { }
220 2 0 unless $args{'no_auto_connect_on_new'}
231 0 0 unless defined $database
234 0 0 if (not defined $self->{'current_database'} or $self->{'current_database'} ne $database)
268 0 2 @_ && ref $_[-1] eq 'CODE' ? :
276 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') { }
289 2 0 unless $self->{'reconnect'}
304 0 0 unless $self->{'reconnect'}
309 0 0 unless ref $_ eq "Redis::X::Reconnect"
313 0 0 if $self->{'__inside_transaction'} or $self->{'__inside_watch'}
315 0 0 unless $self->{'queue'}
316 0 0 if scalar @{[] unless $self->{'queue'};} and $self->{'conservative_reconnect'}
337 0 2 $cb && $custom_decode ? :
342 0 2 if $cb
346 0 1 wantarray && ref $ret eq 'ARRAY' ? :
0 1 $custom_decode ? :
364 0 2 unless $handler
376 0 0 unless $self->{'sock'}
378 0 0 if @_ and ref $_[-1] eq "CODE"
395 0 0 if @_ and ref $_[-1] eq "CODE"
398 0 0 unless $self->{'sock'}
402 0 0 unless $self->__close_sock
411 0 0 if @_ and ref $_[-1] eq "CODE"
414 0 0 unless defined $self->{'sock'}
432 0 0 if not defined $reply or ref $reply
436 0 0 @_ && ref $_[-1] eq 'CODE' ? :
440 0 0 unless $self->{'reconnect'}
458 0 0 if defined $reply and not ref $reply
460 0 0 ref $reply && ($synchronous_scalar || wantarray) ? :
463 0 0 @_ && ref $_[-1] eq 'CODE' ? :
467 0 0 unless $self->{'reconnect'}
501 0 0 unless defined $has_stuff
506 0 0 if (not $self->{'ssl'}) { }
522 0 0 if defined $error
536 0 0 if defined $e and $e ne "EOF from server"
549 0 0 unless ref $cb eq "CODE"
558 0 0 unless $self->{'sock'}
560 0 0 if $unsub
562 0 0 unless @subs
585 0 0 if @$cbs
600 0 0 if defined $error
603 0 0 if ($m->[0] =~ /^p?message$/)
612 0 0 unless $unsub
625 0 0 defined $m->[2] ? :
627 0 0 unless (defined $subs->{$cbid})
644 0 2 if $self->{'is_subscriber'}
662 2 0 unless $self->{'reconnect'}
672 0 0 unless $@
673 0 0 if Time::HiRes::tv_interval($t0) > $self->{'reconnect'}
687 0 2 unless ($self->{'sock'})
693 0 2 if (defined $self->{'username'} and defined $self->{'password'}) { }
0 2 elsif (defined $self->{'password'}) { }
719 0 1 unless defined $self->{'sock'}
729 2 0 unless ($self->{'is_subscriber'})
733 0 0 if ref $n eq "CODE"
734 0 0 if defined $n
735 0 2 if defined $self->{'name'}
740 0 2 if defined $self->{'current_database'}
744 0 0 if ($topic =~ /(p?message):(.*)$/)
746 0 0 if ($key eq 'message') { }
749 0 0 if defined $error
754 0 0 if defined $error
761 0 2 if defined $self->{'on_connect'}
772 0 2 if ($self->{'sock'} and ($self->{'pid'} || 0) != $$)
779 0 2 if $deb
786 0 4 unless utf8::downgrade($bin, 1)
788 4 0 defined $bin ? :
794 0 2 unless defined $status
798 0 2 if $deb
801 0 2 unless defined $len
812 0 2 unless $self->{'sock'}
817 2 0 unless $self->{'debug'}
829 0 1 if ($type eq '-') { }
1 0 elsif ($type eq '+' or $type eq ':') { }
0 0 elsif ($type eq '$') { }
0 0 elsif ($type eq '*') { }
836 0 0 if $result < 0
840 0 0 if $result < 0
845 0 0 if ($collect_errors) { }
849 0 0 if defined $nested[1]
865 1 1 unless (defined $data)
873 0 1 if $self->{'debug'}
884 0 2 if (length $$buf)
886 0 0 if $idx >= 0
891 0 2 if not defined $bytes and $! == 4
892 1 1 unless defined $bytes and $bytes
898 1 0 if $idx >= 0
907 0 0 if ($buflen < $len)
911 0 0 if not defined $bytes and $! == 4
912 0 0 unless defined $bytes
913 0 0 unless $bytes
920 0 0 if $self->{'debug'}
934 0 2 if (&WIN32()) { }
940 2 0 if ($self->{'ssl'}) { }
954 0 2 if (defined $res)
956 0 0 if (length $data)
957 0 0 unless $self->{'ssl'}
965 0 2 if $err and $err == 4
968 2 0 if $err and $err == 11 || $err == 11
972 0 0 if $err and $err == 104
975 0 0 if $err == 0
992 0 0 if $self->{'reconnect'}