Branch Coverage

blib/lib/Gearman/Worker.pm
Criterion Covered Total %
branch 31 124 25.0


line true false branch
110 11 0 if not defined &Gearman::Worker::THROW_EXCEPTIONS or &THROW_EXCEPTIONS()
115 0 11 if (defined &Gearman::Worker::THROW_EXCEPTIONS) { }
120 0 11 if $@
127 7 0 unless ref $self
129 1 6 if ($ENV{'GEARMAN_WORKER_USE_STDIO'})
130 0 1 unless open my $sock, '+<&', \*STDIN
135 1 0 unless $self->_on_connect($sock)
137 0 0 if ($opts{'job_servers'})
162 1 2 unless $ipport
168 0 2 if $self->debug
172 1 1 if $self->{'parent_pipe'}
174 0 1 if (my $sock = $self->{'sock_cache'}{$ipport})
175 0 0 if getpeername $sock
181 0 1 if ($down_since)
182 0 0 if $self->debug
185 0 0 $down_for > 60 ? :
186 0 0 if ($self->{'last_connect_fail'}{$ipport} > $now - $retry_period)
191 0 1 if $self->debug
194 1 0 unless ($sock)
195 0 1 if $self->debug
211 0 0 unless ($self->_on_connect($sock) and $on_connect and &$on_connect($sock))
231 2 0 unless Gearman::Util::send_req($sock, \$cid_req)
236 0 0 unless ($self->_set_ability($sock, $ability, $timeout))
250 1 2 if (defined $timeout) { }
270 0 0 unless my $jss = $self->_get_js_sock($js)
273 0 0 unless (Gearman::Util::send_req($jss, \$req))
294 0 0 if $self->{'parent_pipe'}
313 0 1 if %opts
348 0 0 unless my $jss = $self->_get_js_sock($js, 'on_connect', $on_connect)
356 0 0 unless (Gearman::Util::send_req($jss, \$grab_req))
357 0 0 if ($!{'EPIPE'} and $self->{'parent_pipe'})
372 0 0 $self->{'parent_pipe'} ? :
373 0 0 unless (Gearman::Util::wait_for_readability($jss->fileno, $timeout))
384 0 0 unless ($res)
391 0 0 if ($res->{'type'} eq 'no_job')
392 0 0 unless (Gearman::Util::send_req($jss, \$presleep_req))
400 0 0 unless ($res->{'type'} eq 'job_assign')
402 0 0 if ($res->{'type'} eq 'error')
409 0 0 unless ${$$res{'blobref'};} =~ s/^(.+?)\0(.+?)\0//
416 0 0 if $start_cb
421 0 0 if $err
425 0 0 if ($err)
429 0 0 unless (Gearman::Util::send_req($jss, \$exception_req))
436 0 0 if (defined $ret) { }
437 0 0 ref $ret ? :
440 0 0 if $complete_cb
445 0 0 if $fail_cb
448 0 0 unless (Gearman::Util::send_req($jss, \$work_req))
459 0 0 unless my $jss = $self->_get_js_sock($js, 'on_connect', $on_connect)
473 0 1 keys %active_js ? :
478 0 1 if ($nready)
482 0 0 if vec $wout, $fd, 1
487 0 1 if keys %active_js
489 1 0 if &$stop_if($is_idle, $last_job_time)
494 0 0 if $last_update < $update_since
525 1 1 unless ref $_[0] eq 'CODE'
529 0 2 defined $prefix ? :
532 1 1 if (defined $timeout) { }
552 0 0 defined $prefix ? :
567 0 0 unless my $jss = $self->_get_js_sock($js)
570 0 0 unless (Gearman::Util::send_req($jss, \$req))
588 0 0 if $ENV{'GEARMAN_WORKER_USE_STDIO'}