Branch Coverage

blib/lib/CTK/Timeout.pm
Criterion Covered Total %
branch 15 26 57.6


line true false branch
105 2 0 $USE_POSIX_SIGACTION ? :
117 0 4 unless ref $code eq "CODE"
124 3 1 unless ($timeout)
128 1 2 unless (eval { do { $retval = &$code(@args); 1 } })
129 1 0 if $@
135 1 0 unless eval { do { my($mask, $action, $oldaction); my $use_sa = $self->{'use_sigaction'}; my $h = sub { die "Call timed out\n"; } ; local $SIG{'ALRM'} = $h unless $use_sa; if ($use_sa) { $mask = "POSIX::SigSet"->new(14); $action = "POSIX::SigAction"->new($h, $mask); $oldaction = "POSIX::SigAction"->new; sigaction(14, $action, $oldaction); } ; $failed = 1 unless eval { do { alarm $timeout; $retval = &$code(@args); alarm 0; 1 } }; alarm 0; sigaction(14, $oldaction) if $use_sa; die $@ if $failed and $@; 1 } }
139 0 1 unless $use_sa
140 1 0 if ($use_sa)
146 1 0 unless eval { do { alarm $timeout; $retval = &$code(@args); alarm 0; 1 } }
153 1 0 if $use_sa
154 1 0 if $failed and $@
157 1 0 if ($failed)
158 1 0 if $@