Branch Coverage

blib/lib/Gearman/Worker.pm
Criterion Covered Total %
branch 22 122 18.0


line true false branch
123 6 0 unless ref $self
125 1 5 if ($ENV{'GEARMAN_WORKER_USE_STDIO'})
126 0 1 unless open my $sock, '+<&', \*STDIN
131 1 0 unless $self->_on_connect($sock)
133 0 0 if ($opts{'job_servers'})
162 0 0 unless my $jss = $self->_get_js_sock($js)
165 0 0 unless (_send($jss, $req))
186 0 0 if $self->{'parent_pipe'}
208 0 0 if %opts
246 0 0 unless my $jss = $self->_get_js_sock($js, 'on_connect', $on_connect)
254 0 0 unless (_send($jss, $grab_req))
255 0 0 if ($!{'EPIPE'} and $self->{'parent_pipe'})
271 0 0 $self->{'parent_pipe'} ? :
272 0 0 unless (Gearman::Util::wait_for_readability($jss->fileno, $timeout))
283 0 0 unless ($res)
290 0 0 if ($res->{'type'} eq 'no_job')
291 0 0 unless (_send($jss, $presleep_req))
299 0 0 unless ($res->{'type'} eq 'job_assign')
302 0 0 if ($res->{'type'} eq 'error')
309 0 0 unless ${$$res{'blobref'};} =~ s/^(.+?)\0(.+?)\0//
321 0 0 if $start_cb
326 0 0 if $err
329 0 0 if ($err)
336 0 0 unless (_send($jss, $exception_req))
342 0 0 unless (defined $job_done{$job->handle})
343 0 0 if (defined $ret) { }
352 0 0 if ($done->{'command'} eq 'work_complete') { }
353 0 0 if $complete_cb
356 0 0 if $fail_cb
359 0 0 unless ($done->{'result'})
371 0 0 unless my $jss = $self->_get_js_sock($js_map{$js_str}, 'on_connect', $on_connect)
386 0 0 keys %active_js ? :
391 0 0 if ($nready)
395 0 0 if vec $wout, $fd, 1
400 0 0 if keys %active_js
402 0 0 if &$stop_if($is_idle, $last_job_time)
407 0 0 if $last_update < $update_since
438 1 1 unless ref $_[0] eq 'CODE'
444 1 1 if (defined $timeout) { }
486 0 2 if $ENV{'GEARMAN_WORKER_USE_STDIO'}
510 0 0 ref $data ? :
565 0 0 ref $v ? :
579 0 0 $v ? :
593 0 0 unless my $jss = $self->_get_js_sock($js)
596 0 0 unless (_send($jss, $req))
611 1 2 unless $js
618 0 2 if $self->debug
622 1 1 if $self->{'parent_pipe'}
624 0 1 if (my $sock = $self->_sock_cache($js))
625 0 0 if getpeername $sock
633 0 1 if ($down_since)
634 0 0 if $self->debug
637 0 0 $down_for > 60 ? :
638 0 0 if ($self->{'last_connect_fail'}{$js_str} > $now - $retry_period)
643 0 1 if $self->debug
646 1 0 unless ($sock)
661 0 0 $on_connect ? :
662 0 0 unless ($ok)
683 2 0 unless _send($sock, $cid_req)
688 0 0 unless ($self->_set_ability($sock, $ability, $timeout))
702 1 2 if (defined $timeout) { }