Branch Coverage

blib/lib/PAGI/Server/Runner.pm
Criterion Covered Total %
branch 100 178 56.1


line true false branch
212 10 106 if ($args[$i] eq "server_options" and ref $args[$i + 1] eq "HASH")
221 1 106 if (/^(-[IMMe])(.+)/) { }
266 0 30 unless &GetOptionsFromArray(\@args, "a|app=s", \$opts{'app'}, "e=s", \$opts{'eval'}, "I|lib=s", \@libs, "M=s", \@modules, "o|host=s", \$opts{'host'}, "p|port=i", \$opts{'port'}, "s|server=s", \$opts{'server'}, "E|env=s", \$opts{'env'}, "l|loop=s", \$opts{'loop'}, "access-log=s", \$opts{'access_log'}, "no-access-log", \$opts{'no_access_log'}, "D|daemonize", \$opts{'daemonize'}, "pid=s", \$opts{'pid_file'}, "user=s", \$opts{'user'}, "group=s", \$opts{'group'}, "q|quiet", \$opts{'quiet'}, "default-middleware!", \$opts{'default_middleware'}, "help", \$opts{'help'}, "v|version", \$opts{'version'})
270 6 24 if defined $opts{'server'}
273 1 29 if ($opts{'version'})
277 1 28 if ($opts{'help'})
283 2 26 if defined $opts{'host'}
284 10 18 if defined $opts{'port'}
285 2 26 if defined $opts{'env'}
286 1 27 if defined $opts{'loop'}
287 0 28 if defined $opts{'access_log'}
288 0 28 if $opts{'no_access_log'}
289 4 24 if $opts{'daemonize'}
290 3 25 if defined $opts{'pid_file'}
291 3 25 if defined $opts{'user'}
292 3 25 if defined $opts{'group'}
293 3 25 if $opts{'quiet'}
295 1 27 if defined $opts{'default_middleware'}
298 0 28 if @libs
301 2 26 if @modules
304 4 24 if defined $opts{'eval'}
307 5 23 if (defined $opts{'app'})
328 4 46 if defined $self->{'env'}
329 33 13 if defined $ENV{'PAGI_ENV'}
330 0 13 -t STDIN ? :
346 0 19 if (@{$self->{'libs'};})
355 0 0 if $@
356 0 0 if (defined $imports) { }
365 2 17 if (defined $self->{'eval'})
368 0 2 if $@
369 1 1 unless ref $app eq "CODE"
378 7 10 if (not $self->{'app_spec'} and @argv)
381 7 0 unless ($first =~ /=/)
391 0 17 if (not defined $app_spec) { }
403 1 16 if ($self->_is_module_name($app_spec)) { }
15 1 elsif ($self->_is_file_path($app_spec)) { }
411 0 1 if (-f $app_spec) { }
441 0 11 if ($use_middleware and $self->mode eq "development")
442 0 0 if (eval { do { require PAGI::Middleware::Lint; 1 } }) { }
0 0 elsif (not $self->{'quiet'}) { }
445 0 0 unless $self->{'quiet'}
481 0 16 if ($@)
494 0 16 if ($self->{'no_access_log'}) { }
0 16 elsif ($self->{'access_log'}) { }
16 0 elsif ($self->mode eq 'production') { }
501 0 0 unless open $access_log, ">>", $self->{'access_log'}
519 2 14 $has_socket_or_listen ? :
0 16 $self->{'loop'} ? :
16 0 defined $access_log || $disable_log ? :
544 9 0 unless (ref $self)
561 0 9 if ($self->{'show_version'})
567 0 9 if ($self->{'show_help'})
580 0 9 if ($self->{'daemonize'})
585 0 9 if ($self->{'pid_file'})
592 0 9 if ($self->{'user'} or $self->{'group'})
600 0 6 if $self->{'_pid_file_path'}
605 0 0 if ($_current_runner and $PAGI::Server::Runner::_current_runner->{'_pid_file_path'})
622 9 0 if ($configured)
624 0 9 if ($self->mode ne "production" and not $self->{'quiet'})
647 0 2 unless $module =~ /^[A-Za-z_][A-Za-z0-9_]*(?:::[A-Za-z_][A-Za-z0-9_]*)*$/
656 1 1 if ($@)
661 0 1 unless ($module->can("new") and $module->can("to_app"))
672 0 1 unless (ref $app eq "CODE")
685 1 14 unless -f $file
690 14 0 if (exists $INC{'FindBin.pm'})
696 0 14 if ($@)
699 0 0 if (not defined $app and $!)
702 1 13 unless (ref $app eq "CODE")
715 4 0 if ($arg =~ /^([^=]+)=(.*)$/) { }
786 0 0 unless defined $pid
787 0 0 if $pid
790 0 0 unless setsid()
794 0 0 unless defined $pid
795 0 0 if $pid
799 0 0 unless chdir "/"
805 0 0 unless open STDIN, "<", "/dev/null"
806 0 0 unless open STDOUT, ">", "/dev/null"
807 0 0 unless open STDERR, ">", "/dev/null"
815 0 2 unless open my $fh, ">", $pid_file
827 0 3 unless $self->{'_pid_file_path'}
837 1 4 unless $user or $group
840 0 4 if ($> != 0)
845 2 2 if ($group)
847 2 0 unless defined $gid
851 0 0 if $) != $gid
855 2 0 if ($user)
857 2 0 unless defined $uid
860 0 0 unless ($group)
866 0 0 if $> != $uid