Branch Coverage

blib/lib/Monitoring/Livestatus.pm
Criterion Covered Total %
branch 50 324 15.4


line true false branch
137 3 21 if scalar @args == 1
172 0 96 if (exists $options{$opt_key})
180 93 0 if (exists $self->{$opt_key}) { }
188 0 24 if ($self->{'verbose'} and not defined $self->{'logger'})
193 2 22 if (defined $self->{'timeout'})
203 10 14 unless (defined $self->{'backend'})
206 8 2 if ($peer->{'type'} eq 'UNIX') { }
2 0 elsif ($peer->{'type'} eq 'INET') { }
216 10 14 if (defined $self->{'CONNECTOR'}{'name'} and not defined $self->{'name'})
219 0 24 if (defined $self->{'CONNECTOR'}{'peer'} and not defined $self->{'peer'})
289 0 0 unless defined $limit
292 0 0 unless $result
294 0 0 if not $result and $self->{'verbose'}
296 0 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 0 if $opt->{'data'}
722 0 0 unless defined $statement
726 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) { }
773 0 0 if (defined $opt->{'limit_start'})
778 0 0 if ($statement =~ /^Columns:\ (.*)$/mx) { }
0 0 elsif ($statement =~ /^Stats:\ (.*)$/mx or $statement =~ /^StatsGroupBy:\ (.*)$/mx) { }
785 0 0 if (defined $opt->{'offset'})
790 0 0 if (defined $opt->{'sort'})
797 0 0 unless ($statement =~ /^COMMAND/mx)
798 0 0 if ($opt->{'wrapped_json'}) { }
804 0 0 if ($self->{'keepalive'})
812 0 0 if (defined $opt->{'header'} and ref $opt->{'header'} eq 'HASH')
820 0 0 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 0 if ($self->{'keepalive'})
977 0 0 if $self->{'verbose'}
1100 0 0 if ($self->{'retries_on_connection_error'} <= 0)
1102 0 0 if $msg
1103 0 0 if $ENV{'THRUK_SELECT'}
1111 0 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 0 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 0 0 unless $status
1134 0 0 if $ENV{'THRUK_SELECT'}
1135 0 0 if $status >= 400 and $self->{'errors_are_fatal'}
1143 0 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'}
1191 0 0 if ($status >= 400 and $recv)
1207 0 0 if $self->{'verbose'}
1209 0 0 if ($self->{'retries_on_connection_error'} <= 0)
1210 0 0 if ($self->{'errors_are_fatal'}) { }
1225 0 1 unless (defined $header)
1230 0 1 if ($headerlength != 16)
1237 0 1 if (not $content_length =~ /^\s*(\d+)$/mx) { }
1294 2 42 if (substr($line, 0, 5) ne 'Stats')
1298 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) { }
1356 1 1 if ($line =~ /^Columns:\s+(.*)$/mx)
1358 2 6 if ($column eq 'as') { }
1415 0 1 unless defined $codes->{$code}
1417 0 1 if $append
1427 21 3 if (defined $self->{'peer'})
1428 17 4 if (ref $self->{'peer'} eq '') { }
4 0 elsif (ref $self->{'peer'} eq 'ARRAY') { }
0 0 elsif (ref $self->{'peer'} eq 'HASH') { }
1430 5 12 if (index($self->{'peer'}, ':') > 0) { }
1438 0 4 if (ref $peer eq 'HASH') { }
1439 0 0 unless defined $peer->{'peer'}
1440 0 0 unless defined $peer->{'name'}
1441 0 0 unless (defined $peer->{'type'})
1443 0 0 if (index($peer->{'peer'}, ':') >= 0)
1450 0 4 if (index($peer, ':') >= 0)
1461 0 0 if (index($peer, ':') >= 0)
1470 2 1 if (defined $self->{'socket'})
1474 1 0 if (defined $self->{'server'})
1492 0 0 if ($self->{'warnings'})
1494 0 0 unless (defined $allowed_options->{$key})
1501 0 0 if (defined $return->{'limit'})
1502 0 0 if (index($return->{'limit'}, ',') != -1) { }