| 1 | package Gearman::JobStatus; | ||||||||||||||||||||||||||||
| 2 | 8 | ▶ | use version (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 8 | $Gearman::JobStatus::VERSION = version->declare("2.004.015"); | |||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 8 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 8 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | =head1 NAME | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | Gearman::JobStatus - represents a job status in gearman distributed job system | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | L<Gearman::Client> get_status($handle) returns I<Gearman::JobStatus> for a given handle | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | =head1 METHODS | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | =cut | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 7 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 22 | 7 | my ($class, $known, $running, $nu, $de) = @_; | |||||||||||||||||||||||||||
| 23 | 7 | ▶ | $nu = '' unless defined($nu) && length($nu); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $nu and length $nu
MC/DC50%1/2
defined $nu and length $nu
defined $nu
length $nu
Truth table66%2/3
A and B
A= defined $nuB= length $nu
| |||||||||||||||||||||||||||||
| 24 | 7 | ▶ | $de = '' unless defined($de) && length($de); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $de and length $de
MC/DC50%1/2
defined $de and length $de
defined $de
length $de
Truth table66%2/3
A and B
A= defined $deB= length $de
| |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 7 | return bless [$known, $running, $nu, $de], $class; | |||||||||||||||||||||||||||
| 27 | } ## end sub new | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | =head2 known() | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | =cut | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 2 | ▶ | sub known { shift->[0]; } | ||||||||||||||||||||||||||
|
Subroutine
known: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | =head2 running() | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | =cut | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 2 | ▶ | sub running { shift->[1]; } | ||||||||||||||||||||||||||
|
Subroutine
running: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | =head2 progress() | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | =cut | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 2 | ▶ | sub progress { | ||||||||||||||||||||||||||
|
Subroutine
progress: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 46 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 47 | 2 | ▶ | return $self->[2] ne '' ? [$self->[2], $self->[3]] : undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | =head2 percent() | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | =cut | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 3 | ▶ | sub percent { | ||||||||||||||||||||||||||
|
Subroutine
percent: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 55 | 3 | my $self = shift; | |||||||||||||||||||||||||||
| 56 | 3 | ▶ | return ($self->[2] ne '' && $self->[3]) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->[2] ne "" and $self->[3]
MC/DC100%2/2
$self->[2] ne "" and $self->[3]
$self->[2] ne ""
$self->[3]
Truth table100%3/3
A and B
A= $self->[2] ne ""B= $self->[3]
| |||||||||||||||||||||||||||||
| 57 | ? ($self->[2] / $self->[3]) | ||||||||||||||||||||||||||||
| 58 | : undef; | ||||||||||||||||||||||||||||
| 59 | } ## end sub percent | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 8 | 1; | |||||||||||||||||||||||||||