Branch Coverage

blib/lib/Redis.pm
Criterion Covered Total %
branch 51 244 20.9


line true false branch
42 0 2 unless $socket
44 0 2 unless defined $self->{'read_timeout'} or defined $self->{'write_timeout'}
47 2 0 if defined $self->{'read_timeout'}
49 0 2 if defined $self->{'write_timeout'}
61 0 0 if ($ENV{'REDIS_SERVER'} and not defined $args{'sock'} and not defined $args{'server'} and not defined $args{'sentinels'})
62 0 0 if ($ENV{'REDIS_SERVER'} =~ m[^/]) { }
0 0 elsif ($ENV{'REDIS_SERVER'} =~ /^unix:(.+)/) { }
0 0 elsif ($ENV{'REDIS_SERVER'} =~ /^(?:tcp:)?(.+)/) { }
83 0 2 if (defined $args{'sock'}) { }
0 2 elsif ($args{'sentinels'}) { }
90 0 0 $self->{'cnx_timeout'} ? :
97 0 0 unless ref $self->{'sentinels'} eq 'ARRAY'
101 0 0 unless defined($self->{'service'} = $args{'service'})
108 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) } }
116 0 0 defined $self->{'sentinels_cnx_timeout'} ? :
0 0 defined $self->{'sentinels_read_timeout'} ? :
0 0 defined $self->{'sentinels_write_timeout'} ? :
120 0 0 unless defined $server_address
123 0 0 if $server_address eq 'IDONTKNOW'
130 0 0 unless ($self->{'no_sentinels_list_update'})
151 0 0 $self->{'cnx_timeout'} ? :
158 2 0 defined $args{'server'} ? :
165 0 2 $self->{'cnx_timeout'} ? :
174 2 0 unless $args{'no_auto_connect_on_new'}
185 0 0 unless defined $database
188 0 0 if (not defined $self->{'current_database'} or $self->{'current_database'} ne $database)
222 0 2 @_ && ref $_[-1] eq 'CODE' ? :
230 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') { }
243 2 0 unless $self->{'reconnect'}
258 0 0 unless $self->{'reconnect'}
263 0 0 unless ref $_ eq 'Redis::X::Reconnect'
267 0 0 if $self->{'__inside_transaction'} or $self->{'__inside_watch'}
269 0 0 unless $self->{'queue'}
270 0 0 if scalar @{[] unless $self->{'queue'};} and $self->{'conservative_reconnect'}
291 0 2 $cb && $custom_decode ? :
296 0 2 if $cb
300 0 1 wantarray && ref $ret eq 'ARRAY' ? :
0 1 $custom_decode ? :
318 0 2 unless $handler
330 0 0 unless $self->{'sock'}
332 0 0 if @_ and ref $_[-1] eq 'CODE'
349 0 0 if @_ and ref $_[-1] eq 'CODE'
352 0 0 unless $self->{'sock'}
356 0 0 unless $self->__close_sock
365 0 0 if @_ and ref $_[-1] eq 'CODE'
368 0 0 unless defined $self->{'sock'}
386 0 0 if not defined $reply or ref $reply
390 0 0 @_ && ref $_[-1] eq 'CODE' ? :
394 0 0 unless $self->{'reconnect'}
412 0 0 if defined $reply and not ref $reply
414 0 0 ref $reply && ($synchronous_scalar || wantarray) ? :
417 0 0 @_ && ref $_[-1] eq 'CODE' ? :
421 0 0 unless $self->{'reconnect'}
455 0 0 unless defined $has_stuff
460 0 0 if defined $error
476 0 0 if defined $e and $e ne 'EOF from server'
489 0 0 unless ref $cb eq 'CODE'
498 0 0 unless $self->{'sock'}
500 0 0 if $unsub
502 0 0 unless @subs
525 0 0 if @$cbs
540 0 0 if defined $error
543 0 0 if ($m->[0] =~ /^p?message$/)
552 0 0 unless $unsub
565 0 0 defined $m->[2] ? :
567 0 0 unless (defined $subs->{$cbid})
584 0 2 if $self->{'is_subscriber'}
602 2 0 unless $self->{'reconnect'}
612 0 0 unless $@
613 0 0 if Time::HiRes::tv_interval($t0) > $self->{'reconnect'}
628 0 2 if (defined $self->{'password'})
647 0 1 unless defined $self->{'sock'}
657 2 0 unless ($self->{'is_subscriber'})
661 0 0 if ref $n eq 'CODE'
662 0 0 if defined $n
663 0 2 if defined $self->{'name'}
668 0 2 if defined $self->{'current_database'}
672 0 0 if ($topic =~ /(p?message):(.*)$/)
674 0 0 if ($key eq 'message') { }
677 0 0 if defined $error
682 0 0 if defined $error
689 0 2 if defined $self->{'on_connect'}
700 0 2 if ($self->{'sock'} and ($self->{'pid'} || 0) != $$)
707 0 2 if $deb
714 0 4 unless utf8::downgrade($bin, 1)
716 4 0 defined $bin ? :
721 0 2 unless defined $status
725 0 2 if $deb
728 0 2 unless defined $len
739 0 2 unless $self->{'sock'}
744 2 0 unless $self->{'debug'}
756 0 1 if ($type eq '-') { }
1 0 elsif ($type eq '+' or $type eq ':') { }
0 0 elsif ($type eq '$') { }
0 0 elsif ($type eq '*') { }
763 0 0 if $result < 0
767 0 0 if $result < 0
772 0 0 if ($collect_errors) { }
776 0 0 if defined $nested[1]
792 1 1 unless (defined $data)
800 0 1 if $self->{'debug'}
811 0 2 if (length $$buf)
813 0 0 if $idx >= 0
818 0 2 if not defined $bytes and $! == 4
819 1 1 unless defined $bytes and $bytes
825 1 0 if $idx >= 0
834 0 0 if ($buflen < $len)
838 0 0 if not defined $bytes and $! == 4
839 0 0 unless defined $bytes
840 0 0 unless $bytes
847 0 0 if $self->{'debug'}
861 0 2 if (&WIN32()) { }
871 0 2 if (defined $res)
873 0 0 if (length $data)
882 0 2 if $err and $err == 4
885 2 0 if $err and $err == 11 || $err == 11
889 0 0 if $err and $err == 104
892 0 0 if $err == 0
909 0 0 if $self->{'reconnect'}