Branch Coverage

blib/lib/Gearman/Worker.pm
Criterion Covered Total %
branch 31 122 25.4


line true false branch
120 11 0 if not defined &Gearman::Worker::THROW_EXCEPTIONS or &THROW_EXCEPTIONS()
125 0 11 if (defined &Gearman::Worker::THROW_EXCEPTIONS) { }
130 0 11 if $@
137 7 0 unless ref $self
139 1 6 if ($ENV{'GEARMAN_WORKER_USE_STDIO'})
140 0 1 unless open my $sock, '+<&', \*STDIN
145 1 0 unless $self->_on_connect($sock)
147 0 0 if ($opts{'job_servers'})
171 1 2 unless $js
178 0 2 if $self->debug
182 1 1 if $self->{'parent_pipe'}
184 0 1 if (my $sock = $self->_sock_cache($js))
185 0 0 if getpeername $sock
193 0 1 if ($down_since)
194 0 0 if $self->debug
197 0 0 $down_for > 60 ? :
198 0 0 if ($self->{'last_connect_fail'}{$js_str} > $now - $retry_period)
203 0 1 if $self->debug
206 1 0 unless ($sock)
221 0 0 unless ($self->_on_connect($sock) and $on_connect and &$on_connect($sock))
243 2 0 unless Gearman::Util::send_req($sock, \$cid_req)
248 0 0 unless ($self->_set_ability($sock, $ability, $timeout))
262 1 2 if (defined $timeout) { }
282 0 0 unless my $jss = $self->_get_js_sock($js)
285 0 0 unless (Gearman::Util::send_req($jss, \$req))
306 0 0 if $self->{'parent_pipe'}
326 0 1 if %opts
364 0 0 unless my $jss = $self->_get_js_sock($js, 'on_connect', $on_connect)
372 0 0 unless (Gearman::Util::send_req($jss, \$grab_req))
373 0 0 if ($!{'EPIPE'} and $self->{'parent_pipe'})
388 0 0 $self->{'parent_pipe'} ? :
389 0 0 unless (Gearman::Util::wait_for_readability($jss->fileno, $timeout))
400 0 0 unless ($res)
407 0 0 if ($res->{'type'} eq 'no_job')
408 0 0 unless (Gearman::Util::send_req($jss, \$presleep_req))
416 0 0 unless ($res->{'type'} eq 'job_assign')
418 0 0 if ($res->{'type'} eq 'error')
425 0 0 unless ${$$res{'blobref'};} =~ s/^(.+?)\0(.+?)\0//
432 0 0 if $start_cb
437 0 0 if $err
441 0 0 if ($err)
445 0 0 unless (Gearman::Util::send_req($jss, \$exception_req))
452 0 0 if (defined $ret) { }
453 0 0 ref $ret ? :
456 0 0 if $complete_cb
461 0 0 if $fail_cb
464 0 0 unless (Gearman::Util::send_req($jss, \$work_req))
476 0 0 unless my $jss = $self->_get_js_sock($js_map{$js_str}, 'on_connect', $on_connect)
491 0 1 keys %active_js ? :
496 0 1 if ($nready)
500 0 0 if vec $wout, $fd, 1
505 0 1 if keys %active_js
507 1 0 if &$stop_if($is_idle, $last_job_time)
512 0 0 if $last_update < $update_since
543 1 1 unless ref $_[0] eq 'CODE'
547 0 2 defined $prefix ? :
550 1 1 if (defined $timeout) { }
570 0 0 defined $prefix ? :
585 0 0 unless my $jss = $self->_get_js_sock($js)
588 0 0 unless (Gearman::Util::send_req($jss, \$req))
606 0 3 if $ENV{'GEARMAN_WORKER_USE_STDIO'}