Branch Coverage

blib/lib/Monitoring/Livestatus.pm
Criterion Covered Total %
branch 50 316 15.8


line true false branch
137 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) { }
0 0 elsif ($statement =~ /^Stats:\ (.*)$/mx or $statement =~ /^StatsGroupBy:\ (.*)$/mx) { }
784 0 0 if (defined $opt->{'offset'})
789 0 0 if (defined $opt->{'sort'})
796 0 0 unless ($statement =~ /^COMMAND/mx)
797 0 0 if ($opt->{'wrapped_json'}) { }
803 0 0 if ($self->{'keepalive'})
811 0 0 if (defined $opt->{'header'} and ref $opt->{'header'} eq 'HASH')
819 0 0 if $self->{'verbose'}
821 0 0 if ($self->{'verbose'})
830 0 0 if (not $status or $status >= 300)
831 0 0 unless defined $body
832 0 0 unless defined $status
835 0 0 if (defined $body and $body ne '') { }
840 0 0 if $self->{'verbose'}
841 0 0 if ($self->{'errors_are_fatal'})
848 0 0 unless defined $body
851 0 0 if (defined $opt->{'limit_start'})
854 0 0 if ($status == 200) { }
865 0 0 if ($@)
872 0 0 if ($@)
874 0 0 if $self->{'verbose'}
875 0 0 if ($self->{'errors_are_fatal'})
881 0 0 unless (defined $result)
883 0 0 if $self->{'verbose'}
884 0 0 if ($self->{'errors_are_fatal'})
891 0 0 unless (defined $keys)
892 0 0 if $self->{'verbose'}
893 0 0 if ($self->{'warnings'})
917 0 0 if ($opt->{'wrapped_json'})
924 0 0 if (defined $opt->{'addpeer'} and $opt->{'addpeer'})
928 0 0 if (defined $with_peers and $with_peers == 1)
948 0 0 if ($opt->{'wrapped_json'})
950 0 0 if $key eq 'data'
963 0 0 if ($self->{'keepalive'} and defined $self->{'sock'} and $self->{'sock'}->connected)
964 0 0 if $self->{'verbose'}
971 0 0 if ($self->{'keepalive'})
975 0 0 if $self->{'verbose'}
1097 0 0 if ($self->{'retries_on_connection_error'} <= 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 < $self->{'retries_on_connection_error'}
1117 0 0 if ($@)
1118 0 0 if $self->{'verbose'}
1119 0 0 if (defined $@ and $@ =~ /broken\ pipe/mx)
1121 0 0 if $msg
1124 0 0 if $self->{'errors_are_fatal'}
1127 0 0 unless $status
1129 0 0 if $status >= 400 and $self->{'errors_are_fatal'}
1137 0 0 unless my $sock = $self->_open
1140 0 0 unless print $sock $statement
1151 0 0 if ($statement and $statement =~ /^COMMAND/mx)
1155 0 0 if ($s->can_read(0.5))
1158 0 0 if ($recv)
1160 0 0 if ($recv =~ /^(\d+):\s*(.*)$/mx)
1168 0 0 unless $sock->read($header, 16)
1169 0 0 if $self->{'verbose'}
1171 0 0 unless defined $content_length
1173 0 0 if ($json_decoder) { }
1178 0 0 if ($content_length > 0)
1179 0 0 if ($status == 200) { }
1182 0 0 if ($remaining < $length)
1188 0 0 if ($remaining < $length)
1190 0 0 unless $recv = $json_decoder->incr_parse
1193 0 0 unless $sock->read($recv, $content_length)
1197 0 0 unless $self->{'keepalive'}
1198 0 0 if ($status >= 400 and $recv)
1214 0 0 if $self->{'verbose'}
1216 0 0 if ($self->{'retries_on_connection_error'} <= 0)
1217 0 0 if ($self->{'errors_are_fatal'}) { }
1232 0 1 unless (defined $header)
1237 0 1 if ($headerlength != 16)
1244 0 1 if (not $content_length =~ /^\s*(\d+)$/mx) { }
1301 2 42 if (substr($line, 0, 5) ne 'Stats')
1305 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) { }
1363 1 1 if ($line =~ /^Columns:\s+(.*)$/mx)
1365 2 6 if ($column eq 'as') { }
1424 0 1 unless defined $codes->{$code}
1426 0 1 if $append
1436 21 3 if (defined $self->{'peer'})
1437 17 4 if (ref $self->{'peer'} eq '') { }
4 0 elsif (ref $self->{'peer'} eq 'ARRAY') { }
0 0 elsif (ref $self->{'peer'} eq 'HASH') { }
1439 5 12 if (index($self->{'peer'}, ':') > 0) { }
1447 0 4 if (ref $peer eq 'HASH') { }
1448 0 0 unless defined $peer->{'peer'}
1449 0 0 unless defined $peer->{'name'}
1450 0 0 unless (defined $peer->{'type'})
1452 0 0 if (index($peer->{'peer'}, ':') >= 0)
1459 0 4 if (index($peer, ':') >= 0)
1470 0 0 if (index($peer, ':') >= 0)
1479 2 1 if (defined $self->{'socket'})
1483 1 0 if (defined $self->{'server'})
1501 0 0 if ($self->{'warnings'})
1503 0 0 unless (defined $allowed_options->{$key})
1510 0 0 if (defined $return->{'limit'})
1511 0 0 if (index($return->{'limit'}, ',') != -1) { }