Branch Coverage

blib/lib/Proc/Daemon.pm
Criterion Covered Total %
branch 72 136 52.9


line true false branch
91 0 24 if (not ref $self && eval { do { $self->isa('Proc::Daemon') } }) { }
6 18 elsif (ref $settings_ref eq 'HASH') { }
92 0 0 ref $self eq 'HASH' ? :
105 0 0 unless (open $FH_MEMORY, '+>', undef or $self->{'pid_file'})
112 0 24 if (defined $self->{'dont_close_fd'})
114 0 0 if ref $self->{'dont_close_fd'} ne 'ARRAY'
116 0 0 if $_ =~ /\D/
121 0 24 if (defined $self->{'dont_close_fh'})
123 0 0 if ref $self->{'dont_close_fh'} ne 'ARRAY'
125 0 0 if (defined(my $fn = fileno $_))
133 0 24 ref $self->{'exec_command'} eq 'ARRAY' ? :
134 0 24 if $#exec_command < 0
150 10 14 if (defined $pid and $pid == 0)
155 0 10 unless chdir $self->{'work_dir'}
163 0 10 if POSIX::setsid() < 0
216 10 0 if (defined $pid and $pid == 0)
225 5242890 0 unless ($dont_close_fd{$_})
226 10 5242880 if ($_ == 0) { }
10 5242870 elsif ($_ == 1) { }
10 5242860 elsif ($_ == 2) { }
229 20 5242840 if POSIX::close($_)
237 2 8 if defined $self->{'setgid'}
241 2 8 if defined $self->{'setuid'}
246 10 0 unless $dont_close_fd{'0'}
247 10 0 unless $dont_close_fd{'1'}
248 10 0 unless $dont_close_fd{'2'}
258 10 0 if ($hc_fd)
270 2 8 if ($exec_command)
271 0 0 unless exec $exec_command
290 0 0 if ($FH_MEMORY)
295 0 0 if ($self->{'pid_file'})
296 0 0 unless open my $FH_PIDFILE, '+>', $self->{'pid_file'}
326 0 14 unless defined wantarray
331 14 0 if ($FH_MEMORY) { }
0 0 elsif ($self->{'memory'}{'pid_file'}) { }
333 0 14 $_ eq '' ? :
339 0 0 unless open $FH_MEMORY, '<', $_
346 0 14 wantarray ? :
363 0 24 if $self->{'child_STDIN'}
365 24 0 if $self->{'child_STDOUT'}
367 24 0 if $self->{'child_STDERR'}
370 24 0 if ($self->{'pid_file'})
371 0 24 if $self->{'pid_file'} =~ /^\d+$/
396 0 36 $key eq 'child_STDIN' ? :
12 36 $var =~ s/^([\+\<\>\-\|]+)// ? :
48 24 shift() ? :
399 54 18 if ($var =~ s[^\./][] or not $var =~ m[/])
401 0 54 $self->{'work_dir'} =~ m[/$] ? :
406 18 54 if ($self->{'memory'}{$key}{$var})
409 18 0 $#i ? :
436 34 0 if (defined($pid = fork))
445 0 0 if ($loop < 6 and $! == 11 || $! == 12)
464 0 10 !defined($openmax) || $openmax < 0 ? :
490 0 104 unless $pid
497 84 20 kill(0, $pid) ? :
526 0 4 unless $pid
531 4 0 if ($killed and $pidfile)
533 4 0 if (open my $FH_PIDFILE, '+>', $pidfile) { }
562 114 4 if ($string)
564 100 14 if ($string =~ /^(\d+)$/) { }
14 0 elsif (open my $FH_MEMORY, '<', $string) { }
572 0 14 if $pid =~ /\D/s
585 4 114 unless ($pid)
587 4 0 if ($self->{'pid_file'} and open my $FH_MEMORY, '<', $self->{'pid_file'})
591 4 0 if ($pid and $pid =~ /^(\d+)$/) { }
601 0 0 if (not $pid and $self->{'exec_command'})
645 40 4 unless $_->$command =~ /^$match\s*$/
651 0 4 if $@