Branch Coverage

blib/lib/Gearman/Worker.pm
Criterion Covered Total %
branch 25 124 20.1


line true false branch
123 6 0 unless ref $self
125 1 5 if ($ENV{'GEARMAN_WORKER_USE_STDIO'})
126 0 1 if ($opts{'job_servers'})
138 1 5 if ($ENV{'GEARMAN_WORKER_USE_STDIO'})
139 0 1 unless open my $sock, '+<&', \*STDIN
144 1 0 unless $self->_on_connect($sock)
167 0 0 unless my $jss = $self->_get_js_sock($js)
170 0 0 unless (_send($jss, $req))
191 0 0 if $self->{'parent_pipe'}
213 0 0 if %opts
251 0 0 unless my $jss = $self->_get_js_sock($js, 'on_connect', $on_connect)
259 0 0 unless (_send($jss, $grab_req))
260 0 0 if ($!{'EPIPE'} and $self->{'parent_pipe'})
276 0 0 $self->{'parent_pipe'} ? :
277 0 0 unless (Gearman::Util::wait_for_readability($jss->fileno, $timeout))
288 0 0 unless ($res)
295 0 0 if ($res->{'type'} eq 'no_job')
296 0 0 unless (_send($jss, $presleep_req))
304 0 0 unless ($res->{'type'} eq 'job_assign')
307 0 0 if ($res->{'type'} eq 'error')
314 0 0 unless ${$$res{'blobref'};} =~ s/^(.+?)\0(.+?)\0//
326 0 0 if $start_cb
331 0 0 if $err
334 0 0 if ($err)
341 0 0 unless (_send($jss, $exception_req))
347 0 0 unless (defined $job_done{$job->handle})
348 0 0 if (defined $ret) { }
357 0 0 if ($done->{'command'} eq 'work_complete') { }
358 0 0 if $complete_cb
361 0 0 if $fail_cb
364 0 0 unless ($done->{'result'})
376 0 0 unless my $jss = $self->_get_js_sock($js_map{$js_str}, 'on_connect', $on_connect)
391 0 0 keys %active_js ? :
396 0 0 if ($nready)
400 0 0 if vec $wout, $fd, 1
405 0 0 if keys %active_js
407 0 0 if &$stop_if($is_idle, $last_job_time)
412 0 0 if $last_update < $update_since
443 1 1 unless ref $_[0] eq 'CODE'
449 1 1 if (defined $timeout) { }
491 0 2 if $ENV{'GEARMAN_WORKER_USE_STDIO'}
515 0 0 ref $data ? :
570 0 0 ref $v ? :
584 0 0 $v ? :
598 0 0 unless my $jss = $self->_get_js_sock($js)
601 0 0 unless (_send($jss, $req))
616 1 2 unless $js
623 0 2 if $self->debug
627 1 1 if $self->{'parent_pipe'}
629 0 1 if (my $sock = $self->_sock_cache($js))
630 0 0 if getpeername $sock
638 0 1 if ($down_since)
639 0 0 if $self->debug
642 0 0 $down_for > 60 ? :
643 0 0 if ($self->{'last_connect_fail'}{$js_str} > $now - $retry_period)
648 0 1 if $self->debug
651 1 0 unless ($sock)
666 0 0 $on_connect ? :
667 0 0 unless ($ok)
688 2 0 unless _send($sock, $cid_req)
693 0 0 unless ($self->_set_ability($sock, $ability, $timeout))
707 1 2 if (defined $timeout) { }