Branch Coverage

blib/lib/Monitoring/Livestatus.pm
Criterion Covered Total %
branch 87 322 27.0


line true false branch
137 4 22 if scalar @args == 1
172 0 104 if (exists $options{$opt_key})
180 97 0 if (exists $self->{$opt_key}) { }
188 0 26 if ($self->{'verbose'} and not defined $self->{'logger'})
193 2 24 if (defined $self->{'timeout'})
203 11 15 unless (defined $self->{'backend'})
206 8 3 if ($peer->{'type'} eq 'UNIX') { }
3 0 elsif ($peer->{'type'} eq 'INET') { }
216 11 15 if (defined $self->{'CONNECTOR'}{'name'} and not defined $self->{'name'})
219 0 26 if (defined $self->{'CONNECTOR'}{'peer'} and not defined $self->{'peer'})
289 1 0 unless defined $limit
292 1 0 unless $result
294 0 1 if not $result and $self->{'verbose'}
296 1 0 unless (defined $result)
298 0 0 if $ENV{'THRUK_SELECT'}
300 0 0 unless (defined $result)
301 0 0 unless $self->{'errors_are_fatal'}
307 0 0 if (not $opt->{'offset'} and defined $limit and $limit >= 1)
308 0 0 if (scalar @{$result->{'result'};} > $limit)
313 0 0 if ($opt->{'slice'})
318 0 0 if ($opt->{'rename'})
323 0 0 if ($opt->{'rename'}{$old})
335 0 0 if ($callbacks)
345 0 0 if (exists $opt->{'callbacks'})
348 0 0 if (exists $opt->{'callbacks'})
383 0 0 unless defined $key_field
389 0 0 if ($key_field eq '$peername') { }
0 0 elsif (not defined $row->{$key_field}) { }
453 0 0 if (not defined $opt->{'columns'} or ref $opt->{'columns'} ne 'ARRAY')
490 0 0 if scalar @result > 0
516 0 0 unless defined $result
517 0 0 if scalar @{$result;} > 0
544 0 0 unless defined $result
545 0 0 if scalar @{$result;} > 0
571 0 0 unless defined $row
572 0 0 if scalar @{$row;} > 0
593 0 0 if defined $self->{'CONNECTOR'}
615 0 0 if defined $self->{'CONNECTOR'}
639 0 0 if defined $self->{'CONNECTOR'}
679 0 9 if (defined $value and $value ne '')
701 0 0 unless (defined $self->{'key'})
712 0 1 if $opt->{'data'}
722 0 1 unless defined $statement
726 0 1 if ($statement =~ /^Separators:/mx) { }
0 1 elsif ($statement =~ /^KeepAlive:/mx) { }
0 1 elsif ($statement =~ /^ResponseHeader:/mx) { }
0 1 elsif ($statement =~ /^ColumnHeaders:/mx) { }
0 1 elsif ($statement =~ /^OuputFormat:/mx) { }
0 1 elsif ($statement =~ /^Limit:\ (.*)$/mx and not $1 =~ /^\d+$/mx) { }
0 1 elsif ($statement =~ /^GET\ (.*)$/mx and $1 =~ /^\s*$/mx) { }
0 1 elsif ($statement =~ /^Columns:\ (.*)$/mx and $1 =~ /,/mx || $1 =~ /^\s*$/mx) { }
0 1 elsif (not $statement =~ /^GET\ /mx || $statement =~ /^COMMAND\ /mx) { }
773 0 1 if (defined $opt->{'limit_start'})
778 1 0 if ($statement =~ /^Columns:\ (.*)$/mx) { }
0 0 elsif ($statement =~ /^Stats:\ (.*)$/mx or $statement =~ /^StatsGroupBy:\ (.*)$/mx) { }
785 0 1 if (defined $opt->{'offset'})
790 0 1 if (defined $opt->{'sort'})
797 1 0 unless ($statement =~ /^COMMAND/mx)
798 0 1 if ($opt->{'wrapped_json'}) { }
804 0 1 if ($self->{'keepalive'})
812 0 1 if (defined $opt->{'header'} and ref $opt->{'header'} eq 'HASH')
820 0 1 if $self->{'verbose'}
822 0 0 if $ENV{'THRUK_SELECT'}
823 0 0 if ($self->{'verbose'})
832 0 0 if (not $status or $status >= 300)
833 0 0 unless defined $body
834 0 0 unless defined $status
837 0 0 if (defined $body and $body ne '') { }
842 0 0 if $self->{'verbose'}
843 0 0 if ($self->{'errors_are_fatal'})
850 0 0 unless defined $body
853 0 0 if (defined $opt->{'limit_start'})
856 0 0 if ($status == 200) { }
867 0 0 if ($@)
874 0 0 if ($@)
876 0 0 if $self->{'verbose'}
877 0 0 if ($self->{'errors_are_fatal'})
883 0 0 unless (defined $result)
885 0 0 if $self->{'verbose'}
886 0 0 if ($self->{'errors_are_fatal'})
893 0 0 unless (defined $keys)
894 0 0 if $self->{'verbose'}
895 0 0 if ($self->{'warnings'})
919 0 0 if ($opt->{'wrapped_json'})
926 0 0 if (defined $opt->{'addpeer'} and $opt->{'addpeer'})
930 0 0 if (defined $with_peers and $with_peers == 1)
950 0 0 if ($opt->{'wrapped_json'})
952 0 0 if $key eq 'data'
965 0 0 if ($self->{'keepalive'} and defined $self->{'sock'} and $self->{'sock'}->connected)
966 0 0 if $self->{'verbose'}
973 0 1 if ($self->{'keepalive'})
977 0 1 if $self->{'verbose'}
1100 0 1 if ($self->{'retries_on_connection_error'} <= 0)
1102 0 0 if $msg
1103 0 0 if $ENV{'THRUK_SELECT'}
1111 1 0 if $msg
1112 0 0 if $ENV{'THRUK_SELECT'}
1114 0 0 if $self->{'verbose'}
1115 0 0 if ($status == 491 or $status == 497 or $status == 500)
1116 0 0 if $self->{'verbose'}
1118 0 0 if $retries < $self->{'retries_on_connection_error'}
1122 0 1 if ($@)
1123 0 0 if $self->{'verbose'}
1124 0 0 if (defined $@ and $@ =~ /broken\ pipe/mx)
1126 0 0 if $msg
1127 0 0 if $ENV{'THRUK_SELECT'}
1130 0 0 if $self->{'errors_are_fatal'}
1133 1 0 unless $status
1134 0 1 if $ENV{'THRUK_SELECT'}
1135 1 0 if $status >= 400 and $self->{'errors_are_fatal'}
1143 1 0 unless my $sock = $self->_open
1146 0 0 unless print $sock $statement
1157 0 0 if ($statement and $statement =~ /^COMMAND/mx)
1161 0 0 unless $sock->read($header, 16)
1162 0 0 if $self->{'verbose'}
1164 0 0 unless defined $content_length
1166 0 0 if ($json_decoder) { }
1171 0 0 if ($content_length > 0)
1172 0 0 if ($status == 200) { }
1175 0 0 if ($remaining < $length)
1181 0 0 if ($remaining < $length)
1183 0 0 unless $recv = $json_decoder->incr_parse
1186 0 0 unless $sock->read($recv, $content_length)
1190 0 0 unless $self->{'keepalive'}
1204 0 0 if $self->{'verbose'}
1206 0 0 if ($self->{'retries_on_connection_error'} <= 0)
1207 0 0 if ($self->{'errors_are_fatal'}) { }
1222 0 1 unless (defined $header)
1227 0 1 if ($headerlength != 16)
1234 0 1 if (not $content_length =~ /^\s*(\d+)$/mx) { }
1291 2 42 if (substr($line, 0, 5) ne 'Stats')
1295 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) { }
1353 2 2 if ($line =~ /^Columns:\s+(.*)$/mx)
1355 2 9 if ($column eq 'as') { }
1412 0 2 unless defined $codes->{$code}
1414 1 1 if $append
1424 23 3 if (defined $self->{'peer'})
1425 19 4 if (ref $self->{'peer'} eq '') { }
4 0 elsif (ref $self->{'peer'} eq 'ARRAY') { }
0 0 elsif (ref $self->{'peer'} eq 'HASH') { }
1427 7 12 if (index($self->{'peer'}, ':') > 0) { }
1435 0 4 if (ref $peer eq 'HASH') { }
1436 0 0 unless defined $peer->{'peer'}
1437 0 0 unless defined $peer->{'name'}
1438 0 0 unless (defined $peer->{'type'})
1440 0 0 if (index($peer->{'peer'}, ':') >= 0)
1447 0 4 if (index($peer, ':') >= 0)
1458 0 0 if (index($peer, ':') >= 0)
1467 2 1 if (defined $self->{'socket'})
1471 1 0 if (defined $self->{'server'})
1489 1 0 if ($self->{'warnings'})
1491 0 1 unless (defined $allowed_options->{$key})
1498 0 1 if (defined $return->{'limit'})
1499 0 0 if (index($return->{'limit'}, ',') != -1) { }