Branch Coverage

blib/lib/Perlbal.pm
Criterion Covered Total %
branch 66 332 19.8


line true false branch
199 16 17 if defined $ref
217 0 43 unless (defined $name)
221 0 43 if $service{$name}
222 0 43 if $pool{$name}
245 1 340 unless run_manage_command($cmd, $out, $ctx)
253 0 0 unless $cmd =~ /^(\w+):(.+)/
256 0 0 if ($type eq 'ip')
257 0 0 unless $val =~ /^\w+$/
259 0 0 unless $conf =~ /inet addr:(\S+)/
282 69 413 unless $cmd =~ /^\S/
292 67 294 if $ctx->verbose
296 0 413 unless $cmd =~ /^(\w+)/
302 0 413 if ($basecmd eq 'crash')
306 397 16 if ($main::Perlbal::{"MANAGE_$basecmd"} and $handler = *{"MANAGE_$basecmd";}{'CODE'})
308 0 380 if $@
316 3 13 if $@
317 13 0 if (defined $rval)
319 0 13 if (ref $rval eq 'ARRAY')
336 0 0 if (ref $it eq 'CODE')
338 0 0 if $name =~ /ANON/
348 0 0 unless ($has_gladiator and $has_devel_peek)
359 0 0 unless $$ct{$k} > 1
376 0 0 if (ref $v eq 'ARRAY') { }
0 0 elsif (ref $v eq 'HASH') { }
377 0 0 unless @$v
381 0 0 unless %$v
390 0 0 if (ref $v eq 'HASH')
398 0 0 unless my $v = $TrackVar{$k}
418 0 0 lc $onoff eq 'on' ? :
426 17 0 unless $mc->arg(1)
437 0 0 if $v->can('die_gracefully')
451 0 0 if $ref =~ /^Perlbal::Client/ and $ref ne 'Perlbal::ClientManage'
452 0 0 if $sock->isa('Perlbal::BackendHTTP') and $$sock{'state'} ne 'bored'
458 0 0 if (my $timeout = $mc->arg(2))
470 0 0 if (not $cmd or $cmd eq 'list') { }
0 0 elsif ($cmd eq 'set') { }
0 0 elsif ($cmd eq 'remove') { }
476 0 0 unless ($arg1 and $arg2)
483 0 0 if (delete $$Perlbal::ClientHTTPBase::MimeType{$arg1}) { }
497 0 0 if ($cmd) { }
499 0 0 unless $XSModules{$module}
503 0 0 if ($cmd eq 'enable') { }
0 0 elsif ($cmd eq 'disable') { }
505 0 0 unless $res
510 0 0 unless $res
522 0 0 $enabled ? :
0 0 defined $enabled ? :
526 0 0 unless %XSModules
536 0 0 unless $Perlbal::BSD_RESOURCE_AVAILABLE
543 0 0 if (opendir DIR, '/proc/self/fd') { }
551 0 0 if $res or $! != 9
566 17 0 if ($Perlbal::BSD_RESOURCE_AVAILABLE)
586 0 6 $ip ? :
592 12 73 if (ref $$ref{$ipport}{$key} eq 'ARRAY') { }
605 0 6 if ($spec_ipport) { }
623 0 0 if ($which eq 'on')
624 0 0 if ('Danga::Socket'->EnableProfiling) { }
631 0 0 if ($which eq 'off')
636 0 0 if ($which eq 'data')
681 0 0 if ($mode eq 'summary') { }
0 0 elsif ($mode eq 'all') { }
689 0 0 if ($v->isa('Perlbal::ClientHTTPBase'))
691 0 0 if $$cv{'reproxy_fh'}
723 0 0 if ($sock->isa('Perlbal::BackendHTTP'))
759 0 0 unless defined $be
776 0 0 if (defined $mc->arg(1))
778 0 0 unless defined $svc
786 0 0 unless $sock->can('state')
788 0 0 unless defined $state
789 0 0 if (defined $svc)
790 0 0 unless $sock->isa('Perlbal::ClientProxy') or $sock->isa('Perlbal::BackendHTTP') or $sock->isa('Perlbal::ClientHTTP')
793 0 0 unless $$sock{'service'} == $svc
812 0 0 unless $$svc{'role'} eq 'reverse_proxy'
824 0 0 if defined $oldest
848 0 0 unless $ENV{'PERLBAL_DEBUG'}
858 0 0 unless $_
859 0 0 if ($what) { }
861 0 0 if $@
862 0 0 unless defined $rv
874 0 1 if ($mc->cmd =~ /^show service (\w+)$/)
877 0 0 unless $svc
882 0 1 if ($mc->cmd =~ /^show pool(?:\s+(\w+))?$/)
884 0 0 if ($pool) { }
886 0 0 unless $pl
902 1 0 if ($mc->cmd =~ /^show service$/)
906 4 0 $$svc{'enabled'} ? :
918 0 14 if ($key =~ /^max_reproxy_connections(?:\((.+)\))?/)
919 0 0 unless $val =~ /^-?\d+$/
921 0 0 if (defined $hostip) { }
929 0 14 if ($key eq 'max_connections')
930 0 0 unless $Perlbal::BSD_RESOURCE_AVAILABLE
931 0 0 unless $val =~ /^-?\d+$/
933 0 0 unless (defined $rv and $rv)
934 0 0 if ($> == 0) { }
943 0 14 if ($key eq 'nice_level')
944 0 0 unless $val =~ /^-?\d+$/
946 0 0 unless defined $rv
951 14 0 if ($key eq 'aio_mode')
952 0 14 unless $val =~ /^none|linux|ioaio$/
953 0 14 if $val eq 'linux'
954 4 10 if $val eq 'ioaio' and not $Perlbal::OPTMOD_IO_AIO
959 0 0 if ($key eq 'aio_threads')
960 0 0 unless $val =~ /^-?\d+$/
961 0 0 if $Perlbal::OPTMOD_IO_AIO
966 0 0 if ($key eq 'track_obj')
967 0 0 unless $val eq '1' or $val eq '0'
969 0 0 if $val
973 0 0 if ($key eq 'pidfile')
974 0 0 if $run_started
975 0 0 unless $val
980 0 0 if ($key eq 'crash_backtrace')
981 0 0 unless $val eq '1' or $val eq '0'
982 0 0 if ($val) { }
999 0 0 if ($pool->can('dumpconfig')) { }
1014 0 0 if ($service->can('dumpconfig')) { }
1023 0 0 $$service{'enabled'} ? :
1043 43 9 if ($what eq 'service')
1044 0 43 if $service{$name}
1045 0 43 if $pool{$name}
1051 9 0 if ($what eq 'pool')
1052 0 9 if $pool{$name}
1053 0 9 if $service{$name}
1065 0 0 unless $pool{$name} or $service{$name}
1079 14 0 if $name =~ /$good_cmd/
1080 0 14 unless $cmd =~ /$good_cmd/
1084 0 14 unless $pl
1101 0 226 unless ($name ||= $$mc{'ctx'}{'last_created'})
1105 226 0 if (my $svc = $service{$name}) { }
0 0 elsif (my $pl = $pool{$name}) { }
1120 0 2 unless $svc
1129 0 42 unless $svc
1148 6 0 if $mc->orig =~ /^load (\w+)$/i
1165 6 0 if ($rv)
1171 0 0 unless defined $good_error
1174 0 0 if ($@ and exists $INC{$file})
1180 6 0 unless (defined $good_error)
1183 6 0 if ($rv)
1199 0 0 unless my $class = $PluginCase{lc $fn}
1203 0 0 unless eval "$class->can_reload"
1206 0 0 if ($class->can('pre_reload_unload'))
1207 0 0 unless eval "$class->pre_reload_unload; 1"
1211 0 0 unless eval "$class->unload; 1;"
1217 0 0 unless delete $INC{$file}
1221 0 0 unless eval "use $class; $class->load; 1;"
1230 0 0 unless @{$$svc{'plugin_order'};}
1238 0 0 /^MANAGE_(\S+)$/ ? :
1260 1 3 unless open my $fh, $file
1264 0 24 unless run_manage_command($line, $writer, $ctx)
1277 0 0 if $Perlbal::OPTMOD_IO_AIO
1281 0 0 unless sigprocmask(0, $sigset)
1285 0 0 if ($pid = fork)
1287 0 0 unless sigprocmask(1, $sigset)
1291 0 0 unless $sess_id = POSIX::setsid()
1318 17 0 unless ($run_started)
1323 0 17 if $Perlbal::OPTMOD_IO_AIO
1327 0 17 if ($Perlbal::OPTMOD_IO_AIO)
1345 17 0 if $Perlbal::SYSLOG_AVAILABLE
1349 0 17 if $pidfile
1370 0 0 if ($@)
1378 0 0 if $pidfile_written
1382 0 0 if $Perlbal::SYSLOG_AVAILABLE
1389 17 0 if ($foreground) { }
1393 0 17 if (@_) { }
1400 0 0 if $Perlbal::syslog_open
1409 0 0 unless (open $fh, ">$file")
1413 0 0 unless (print $fh "$$\n" and close $fh)