Branch Coverage

blib/lib/Monitoring/Livestatus.pm
Criterion Covered Total %
branch 50 340 14.7


line true false branch
136 3 21 if scalar @args == 1
177 0 96 if (exists $options{$opt_key})
185 93 0 if (exists $self->{$opt_key}) { }
193 0 24 if ($self->{'verbose'} and not defined $self->{'logger'})
198 2 22 if (defined $self->{'timeout'})
208 10 14 unless (defined $self->{'backend'})
211 8 2 if ($peer->{'type'} eq 'UNIX') { }
2 0 elsif ($peer->{'type'} eq 'INET') { }
221 10 14 if (defined $self->{'CONNECTOR'}{'name'} and not defined $self->{'name'})
224 0 24 if (defined $self->{'CONNECTOR'}{'peer'} and not defined $self->{'peer'})
294 0 0 unless defined $limit
297 0 0 unless $result
299 0 0 if not $result and $self->{'verbose'}
301 0 0 unless (defined $result)
304 0 0 unless (defined $result)
305 0 0 unless $self->{'errors_are_fatal'}
311 0 0 if (not $opt->{'offset'} and defined $limit and $limit >= 1)
312 0 0 if (scalar @{$result->{'result'};} > $limit)
317 0 0 if ($opt->{'slice'})
322 0 0 if ($opt->{'rename'})
327 0 0 if ($opt->{'rename'}{$old})
339 0 0 if ($callbacks)
349 0 0 if (exists $opt->{'callbacks'})
352 0 0 if (exists $opt->{'callbacks'})
387 0 0 unless defined $key_field
393 0 0 if ($key_field eq '$peername') { }
0 0 elsif (not defined $row->{$key_field}) { }
457 0 0 if (not defined $opt->{'columns'} or ref $opt->{'columns'} ne "ARRAY")
494 0 0 if scalar @result > 0
520 0 0 unless defined $result
521 0 0 if scalar @{$result;} > 0
548 0 0 unless defined $result
549 0 0 if scalar @{$result;} > 0
575 0 0 unless defined $row
576 0 0 if scalar @{$row;} > 0
597 0 0 if defined $self->{'CONNECTOR'}
619 0 0 if defined $self->{'CONNECTOR'}
643 0 0 if defined $self->{'CONNECTOR'}
683 0 9 if (defined $value and $value ne "")
711 0 0 if $opt->{'data'}
721 0 0 unless defined $statement
725 0 0 if ($statement =~ /^Separators:/mx) { }
0 0 elsif ($statement =~ /^KeepAlive:/mx) { }
0 0 elsif ($statement =~ /^ResponseHeader:/mx) { }
0 0 elsif ($statement =~ /^ColumnHeaders:/mx) { }
0 0 elsif ($statement =~ /^OuputFormat:/mx) { }
0 0 elsif ($statement =~ /^Limit:\ (.*)$/mx and not $1 =~ /^\d+$/mx) { }
0 0 elsif ($statement =~ /^GET\ (.*)$/mx and $1 =~ /^\s*$/mx) { }
0 0 elsif ($statement =~ /^Columns:\ (.*)$/mx and $1 =~ /,/mx || $1 =~ /^\s*$/mx) { }
0 0 elsif (not $statement =~ /^GET\ /mx || $statement =~ /^COMMAND\ /mx) { }
772 0 0 if (defined $opt->{'limit_start'})
777 0 0 if ($statement =~ /^Columns:\ (.*)$/mx)
780 0 0 if ($statement =~ /^Stats:\ (.*)$/mx or $statement =~ /^StatsGroupBy:\ (.*)$/mx)
781 0 0 defined $keys ? :
783 0 0 if $has_columns
787 0 0 if (defined $opt->{'offset'})
792 0 0 if (defined $opt->{'sort'})
799 0 0 unless ($statement =~ /^COMMAND/mx)
800 0 0 if ($opt->{'wrapped_json'}) { }
806 0 0 if ($self->{'keepalive'})
814 0 0 if (defined $opt->{'header'} and ref $opt->{'header'} eq "HASH")
822 0 0 if $self->{'verbose'}
824 0 0 if ($self->{'verbose'})
833 0 0 if (not $status or $status >= 300)
834 0 0 unless defined $body
835 0 0 unless defined $status
838 0 0 if (defined $body and $body ne '') { }
843 0 0 if $self->{'verbose'}
844 0 0 if ($self->{'errors_are_fatal'})
851 0 0 unless defined $body
855 0 0 if ($status == 200) { }
866 0 0 if ($@)
873 0 0 if ($@)
875 0 0 if $self->{'verbose'}
876 0 0 if ($self->{'errors_are_fatal'})
882 0 0 unless (defined $result)
884 0 0 if $self->{'verbose'}
885 0 0 if ($self->{'errors_are_fatal'})
892 0 0 unless (defined $keys)
893 0 0 if $self->{'verbose'}
894 0 0 if ($self->{'warnings'})
918 0 0 if ($opt->{'wrapped_json'})
925 0 0 if (defined $opt->{'addpeer'} and $opt->{'addpeer'})
929 0 0 if (defined $with_peers and $with_peers == 1)
949 0 0 if ($opt->{'wrapped_json'})
961 0 0 if ($self->{'keepalive'} and defined $self->{'sock'} and $self->{'sock'}->connected)
962 0 0 if $self->{'verbose'}
969 0 0 if ($self->{'keepalive'})
973 0 0 if $self->{'verbose'}
1097 0 0 if ($maxretries <= 0)
1099 0 0 if $msg
1107 0 0 if $msg
1109 0 0 if $self->{'verbose'}
1110 0 0 if ($status == 491 or $status == 497 or $status == 500)
1111 0 0 if $self->{'verbose'}
1113 0 0 if $retries < $maxretries
1118 0 0 if ($err)
1119 0 0 if $self->{'verbose'}
1120 0 0 if ($err =~ /broken\ pipe/mx)
1122 0 0 if $msg
1125 0 0 if $self->{'errors_are_fatal'}
1128 0 0 unless $status
1130 0 0 if $status >= 400 and $self->{'errors_are_fatal'}
1138 0 0 unless my $sock = $self->_open
1141 0 0 $! ? :
0 0 unless $sock->printflush($statement, "\n")
1154 0 0 if ($statement and $statement =~ /^COMMAND/mx)
1156 0 0 if ($s->can_read(3))
1159 0 0 if ($recv)
1161 0 0 if ($recv =~ /^(\d+):\s*(.*)$/mx)
1170 0 0 if ($statement)
1172 0 0 if $statement =~ /^GET\s+status/mx
1173 0 0 if $statement =~ /^GET\s+log/mx
1175 0 0 if $self->{'query_timeout'}
1179 0 0 if (scalar @ready == 0)
1181 0 0 if ($err)
1187 0 0 $! ? :
0 0 unless $sock->read($header, 16)
1188 0 0 if $self->{'verbose'}
1190 0 0 unless defined $content_length
1192 0 0 if ($json_decoder) { }
1197 0 0 if ($content_length > 0)
1198 0 0 if ($status == 200) { }
1201 0 0 if ($remaining < $length)
1207 0 0 if ($remaining < $length)
1209 0 0 $! ? :
0 0 unless $recv = $json_decoder->incr_parse
1212 0 0 $! ? :
0 0 unless $sock->read($recv, $content_length)
1216 0 0 unless $self->{'keepalive'}
1217 0 0 if ($status >= 400 and $recv)
1231 0 0 if $self->{'verbose'}
1233 0 0 if ($self->{'retries_on_connection_error'} <= 0)
1234 0 0 if ($self->{'errors_are_fatal'}) { }
1242 0 0 $err ? :
1249 0 1 unless (defined $header)
1254 0 1 if ($headerlength != 16)
1261 0 1 if (not $content_length =~ /^\s*(\d+)$/mx) { }
1318 2 42 if (substr($line, 0, 5) ne "Stats")
1322 5 37 if ($line =~ /^Stats:\ (.*)\s+as\s+(.*?)$/mox) { }
27 10 elsif ($line =~ /^Stats:\ (.*)$/mox) { }
4 6 elsif ($line =~ /^StatsAnd:\ (\d+)\s+as\s+(.*?)$/mox) { }
4 2 elsif ($line =~ /^StatsAnd:\ (\d+)$/mox) { }
1 1 elsif ($line =~ /^StatsOr:\ (\d+)\s+as\s+(.*?)$/mox) { }
1 0 elsif ($line =~ /^StatsOr:\ (\d+)$/mox) { }
0 0 elsif ($line =~ /^StatsGroupBy:\ (.*)\s+as\s+(.*?)$/mox) { }
0 0 elsif ($line =~ /^StatsGroupBy:\ (.*)$/mox) { }
1380 1 1 if ($line =~ /^Columns:\s+(.*)$/mx)
1382 2 6 if ($column eq 'as') { }
1441 0 1 unless defined $codes->{$code}
1443 0 1 if $append
1453 21 3 if (defined $self->{'peer'})
1454 17 4 if (ref $self->{'peer'} eq '') { }
4 0 elsif (ref $self->{'peer'} eq 'ARRAY') { }
0 0 elsif (ref $self->{'peer'} eq 'HASH') { }
1456 5 12 if (index($self->{'peer'}, ':') > 0) { }
1464 0 4 if (ref $peer eq 'HASH') { }
1465 0 0 unless defined $peer->{'peer'}
1466 0 0 unless defined $peer->{'name'}
1467 0 0 unless (defined $peer->{'type'})
1469 0 0 if (index($peer->{'peer'}, ":") != -1)
1476 0 4 if (index($peer, ":") != -1)
1487 0 0 if (index($peer, ":") != -1)
1496 2 1 if (defined $self->{'socket'})
1500 1 0 if (defined $self->{'server'})
1518 0 0 if ($self->{'warnings'})
1520 0 0 unless (defined $allowed_options->{$key})
1527 0 0 if (defined $return->{'limit'})
1528 0 0 if (index($return->{'limit'}, ',') != -1) { }
1565 0 0 if (scalar @lines > 2)