Branch Coverage

blib/lib/Daemon/Daemonize.pm
Criterion Covered Total %
branch 35 78 44.8


line true false branch
26 0 17 unless defined $pid
35 0 3 if not defined $openmax or $openmax < 0
37 0 3 unless $from < $openmax
48 10 10 if (my $run = delete $options{'run'})
50 3 1 if (-1 == $self->daemonize(%options, 'continue', 1)) { }
63 0 10 exists $options{'chdir'} ? :
64 0 10 defined $options{'close'} ? :
68 3 7 if (my $pid = $self->_fork_or_die)
69 3 0 if $options{'continue'}
75 0 7 unless POSIX::setsid()
79 4 3 if $self->_fork_or_die
84 3 0 if (defined $chdir)
85 0 3 unless chdir $chdir
88 3 0 if ($close eq 1 or $close eq '!std')
90 0 3 $close eq '!std' ? :
96 3 0 if ($close eq 1 or $close eq 'std')
98 0 3 unless open STDIN, '+>/dev/null'
100 1 2 unless ($stdout_file)
101 0 1 unless open STDOUT, '+>&STDIN'
104 1 2 unless ($stderr_file)
105 0 1 unless open STDERR, '+>&STDIN'
114 2 1 if ($stdout_file)
115 2 0 unless open STDOUT, '>>', $stdout_file
118 0 1 if ($stderr_file)
119 0 0 unless open STDERR, '>>', $stderr_file
127 0 7 unless defined $pidfile
128 0 7 ref $pidfile eq 'ARRAY' ? :
136 3 0 unless -s $pidfile
137 0 0 unless -f $pidfile and -r $pidfile
147 3 0 unless $pid
148 0 0 unless $self->does_process_exist($pid)
176 0 0 unless $pid
178 0 0 if kill 0, $pid
181 0 0 if (eval { do { require Errno } })
182 0 0 if exists &Errno::EPERM and $errno == &Errno::EPERM
194 0 0 unless $pid
196 0 0 $pid ? :
206 0 0 unless $port
209 0 0 if ($socket)