| 1 | package Beanstalk::Client; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use base qw(Class::Accessor::Fast); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 3 | ▶ | use YAML::Syck; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 3 | ▶ | use Socket; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 3 | ▶ | use IO::Socket::INET; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 3 | ▶ | use Beanstalk::Job; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 3 | ▶ | use Beanstalk::Stats; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 3 | our $VERSION = "1.07"; | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | # use namespace::clean; | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 3 | our $CRLF = "\015\012"; | |||||||||||||||||||||||||||
| 20 | 3 | ▶ | our $MSG_NOSIGNAL = eval { Socket::MSG_NOSIGNAL() } || 0; | ||||||||||||||||||||||||||
|
Condition50%1/2
eval {
do {
16384
}
} || 0
MC/DC0%0/1
eval {
do {
16384
}
} || 0
eval {
do {
16384
}
}
Truth table50%1/2
A
A= eval {
do {
16384
}
}
| |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 3 | ▶ | BEGIN { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | 3 | __PACKAGE__->mk_accessors( | |||||||||||||||||||||||||||
| 24 | qw( | ||||||||||||||||||||||||||||
| 25 | connect_timeout | ||||||||||||||||||||||||||||
| 26 | debug | ||||||||||||||||||||||||||||
| 27 | decoder | ||||||||||||||||||||||||||||
| 28 | default_tube | ||||||||||||||||||||||||||||
| 29 | delay | ||||||||||||||||||||||||||||
| 30 | encoder | ||||||||||||||||||||||||||||
| 31 | error | ||||||||||||||||||||||||||||
| 32 | priority | ||||||||||||||||||||||||||||
| 33 | server | ||||||||||||||||||||||||||||
| 34 | socket | ||||||||||||||||||||||||||||
| 35 | ttr | ||||||||||||||||||||||||||||
| 36 | _watching | ||||||||||||||||||||||||||||
| 37 | _using | ||||||||||||||||||||||||||||
| 38 | ) | ||||||||||||||||||||||||||||
| 39 | ); | ||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | # no namespace::clean; | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 1 | ▶ | sub _interact { | ||||||||||||||||||||||||||
|
Subroutine
_interact: called CC=15 SCAR=52.9
| |||||||||||||||||||||||||||||
| 45 | 1 | my ($self, $cmd, $data) = @_; | |||||||||||||||||||||||||||
| 46 | 1 | ▶ | my $sock = $self->socket || $self->connect | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->socket || $self->connect
MC/DC0%0/2
$self->socket || $self->connect
$self->socket
$self->connect
Truth table33%1/3
A || B
A= $self->socketB= $self->connect
| |||||||||||||||||||||||||||||
| 47 | or return; | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 0 | ▶ | local $SIG{PIPE} = "IGNORE" unless $MSG_NOSIGNAL; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 0 | my $debug = $self->debug; | |||||||||||||||||||||||||||
| 52 | 0 | ▶ | warn $cmd ."\n" if $debug; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 0 | $cmd .= $CRLF; | |||||||||||||||||||||||||||
| 55 | 0 | ▶ | $cmd .= $data . $CRLF if defined $data; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 0 | my $offset = 0; | |||||||||||||||||||||||||||
| 58 | WRITE: { | ||||||||||||||||||||||||||||
| 59 | 0 | my $sent = send($sock, substr($cmd, $offset), $MSG_NOSIGNAL); | |||||||||||||||||||||||||||
| 60 | 0 | ▶ | if ($sent) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 61 | 0 | $offset += $sent; | |||||||||||||||||||||||||||
| 62 | 0 | ▶ | redo WRITE if $offset < length($cmd); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||
| 64 | else { | ||||||||||||||||||||||||||||
| 65 | 0 | $self->error("$!"); | |||||||||||||||||||||||||||
| 66 | 0 | ▶ | redo WRITE if $!{EINTR} and fileno($sock); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$!{"EINTR"} and fileno $sock
MC/DC0%0/2
$!{"EINTR"} and fileno $sock
$!{"EINTR"}
fileno $sock
Truth table0%0/3
A and B
A= $!{"EINTR"}B= fileno $sock
| |||||||||||||||||||||||||||||
| 67 | 0 | return $self->disconnect; | |||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 0 | my $buffer; | |||||||||||||||||||||||||||
| 72 | 0 | $offset = 0; | |||||||||||||||||||||||||||
| 73 | READ: { | ||||||||||||||||||||||||||||
| 74 | 0 | my $read = sysread($sock, $buffer, 1024, $offset); | |||||||||||||||||||||||||||
| 75 | 0 | ▶ | if ($read) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 76 | 0 | ▶ | if ($buffer =~ /^([^\015\012]+)\015\012/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 77 | 0 | $self->{_recv_buffer} = substr($buffer, 2 + length($1)); | |||||||||||||||||||||||||||
| 78 | 0 | ▶ | warn $1,"\n" if $debug; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 79 | 0 | return split(' ', $1); | |||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||
| 81 | 0 | $offset += length $buffer; | |||||||||||||||||||||||||||
| 82 | 0 | redo READ; | |||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||
| 84 | else { | ||||||||||||||||||||||||||||
| 85 | 0 | $self->error("$!"); | |||||||||||||||||||||||||||
| 86 | 0 | ▶ | redo READ if $!{EINTR} and fileno($sock); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$!{"EINTR"} and fileno $sock
MC/DC0%0/2
$!{"EINTR"} and fileno $sock
$!{"EINTR"}
fileno $sock
Truth table0%0/3
A and B
A= $!{"EINTR"}B= fileno $sock
| |||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||
| 89 | 0 | $self->disconnect; | |||||||||||||||||||||||||||
| 90 | 0 | return; | |||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | 0 | ▶ | sub _recv_data { | ||||||||||||||||||||||||||
|
Subroutine
_recv_data: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||
| 95 | 0 | my ($self, $bytes) = @_; | |||||||||||||||||||||||||||
| 96 | 0 | my $sock = $self->socket; | |||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | 0 | my $need = $bytes + 2; # count CRLF | |||||||||||||||||||||||||||
| 99 | 0 | my $offset = length($self->{_recv_buffer}); | |||||||||||||||||||||||||||
| 100 | 0 | my $more = $need - $offset; | |||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | 0 | ▶ | READ: while ($more > 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 103 | 0 | my $read = sysread($sock, $self->{_recv_buffer}, $more, $offset); | |||||||||||||||||||||||||||
| 104 | 0 | ▶ | if ($read) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 105 | 0 | $offset += $read; | |||||||||||||||||||||||||||
| 106 | 0 | $more -= $read; | |||||||||||||||||||||||||||
| 107 | 0 | ▶ | last if $more == 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 108 | 0 | redo READ; | |||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||
| 110 | else { | ||||||||||||||||||||||||||||
| 111 | 0 | ▶ | redo READ if $!{EINTR}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 112 | 0 | $self->error("$!"); | |||||||||||||||||||||||||||
| 113 | 0 | return $self->disconnect; | |||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||
| 116 | 0 | ▶ | warn substr($self->{_recv_buffer}, 0, $bytes),"\n" if $self->debug; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 117 | 0 | return substr($self->{_recv_buffer}, 0, $bytes); | |||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | 1 | ▶ | sub _interact_yaml_resp { | ||||||||||||||||||||||||||
|
Subroutine
_interact_yaml_resp: called CC=4 SCAR=24.2
| |||||||||||||||||||||||||||||
| 122 | 1 | my ($self, $cmd) = @_; | |||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | 1 | ▶ | my @resp = _interact($self, $cmd) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 125 | or return; | ||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | 0 | ▶ | if ($resp[0] eq 'OK') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 128 | 0 | ▶ | my $data = _recv_data($self, $resp[1]) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 129 | or return undef; | ||||||||||||||||||||||||||||
| 130 | 0 | return YAML::Syck::Load($data); | |||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | 0 | $self->error(join ' ', @resp); | |||||||||||||||||||||||||||
| 134 | 0 | return undef; | |||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | 0 | ▶ | sub _interact_stats { | ||||||||||||||||||||||||||
|
Subroutine
_interact_stats: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 139 | 0 | ▶ | my $ret = _interact_yaml_resp(@_) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 140 | or return undef; | ||||||||||||||||||||||||||||
| 141 | 0 | return Beanstalk::Stats->new($ret); | |||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | 0 | ▶ | sub _peek { | ||||||||||||||||||||||||||
|
Subroutine
_peek: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 146 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 147 | 0 | my $cmd = shift; | |||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | 0 | ▶ | my @resp = _interact($self, $cmd) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 150 | or return undef; | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | 0 | ▶ | if ($resp[0] eq 'FOUND') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 153 | 0 | my $data = _recv_data($self, $resp[2]); | |||||||||||||||||||||||||||
| 154 | 0 | ▶ | return undef unless defined $data; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 155 | 0 | return Beanstalk::Job->new( | |||||||||||||||||||||||||||
| 156 | { id => $resp[1], | ||||||||||||||||||||||||||||
| 157 | client => $self, | ||||||||||||||||||||||||||||
| 158 | data => $data, | ||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||
| 160 | ); | ||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | 0 | $self->error(join ' ', @resp); | |||||||||||||||||||||||||||
| 164 | 0 | return undef; | |||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | 0 | ▶ | sub __watching { | ||||||||||||||||||||||||||
|
Subroutine
__watching: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 168 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 169 | 0 | my $watching = $self->_watching; | |||||||||||||||||||||||||||
| 170 | 0 | ▶ | return $watching if $watching; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 171 | 0 | $self->list_tubes_watched; | |||||||||||||||||||||||||||
| 172 | 0 | $self->_watching; | |||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | # use namespace::clean; | ||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | 4 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 178 | 4 | my $proto = shift; | |||||||||||||||||||||||||||
| 179 | 4 | ▶ | my $fields = shift || {}; | ||||||||||||||||||||||||||
|
Condition50%1/2
shift() || {}
MC/DC0%0/1
shift() || {}
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 180 | 4 | my $self = $proto->SUPER::new( | |||||||||||||||||||||||||||
| 181 | { delay => 0, | ||||||||||||||||||||||||||||
| 182 | ttr => 120, | ||||||||||||||||||||||||||||
| 183 | priority => 10_000, | ||||||||||||||||||||||||||||
| 184 | encoder => \&YAML::Syck::Dump, | ||||||||||||||||||||||||||||
| 185 | decoder => \&YAML::Syck::Load, | ||||||||||||||||||||||||||||
| 186 | %$fields, | ||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||
| 188 | ); | ||||||||||||||||||||||||||||
| 189 | 4 | $self->{_recv_buffer} = ''; | |||||||||||||||||||||||||||
| 190 | 4 | $self; | |||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | 3 | ▶ | sub connect { | ||||||||||||||||||||||||||
|
Subroutine
connect: called CC=11 SCAR=40.2
Pod
documented
| |||||||||||||||||||||||||||||
| 195 | 3 | my $self = shift; | |||||||||||||||||||||||||||
| 196 | 3 | ▶ | my $server = $self->server || "127.0.0.1"; | ||||||||||||||||||||||||||
|
Condition50%1/2
$self->server || '127.0.0.1'
MC/DC0%0/1
$self->server || '127.0.0.1'
$self->server
Truth table50%1/2
A
A= $self->server
| |||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | 3 | ▶ | $server .= ":11300" unless $server =~ /:/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||
| 200 | 3 | my $timeout = $self->connect_timeout; | |||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | 3 | my $sock = IO::Socket::INET->new( | |||||||||||||||||||||||||||
| 203 | PeerAddr => $server, | ||||||||||||||||||||||||||||
| 204 | Timeout => $timeout, | ||||||||||||||||||||||||||||
| 205 | ); | ||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | 3 | ▶ | unless ($sock) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 208 | 3 | $self->error("connect: $@"); | |||||||||||||||||||||||||||
| 209 | 3 | return $self->disconnect; | |||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||
| 212 | 0 | $self->socket($sock); | |||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||
| 214 | 0 | my $was_watching = $self->_watching; | |||||||||||||||||||||||||||
| 215 | 0 | my $was_using = $self->_using; | |||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||
| 217 | 0 | $self->list_tubes_watched; | |||||||||||||||||||||||||||
| 218 | 0 | ▶ | if ($was_watching) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 219 | 0 | ▶ | $self->watch_only(keys %$was_watching) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 220 | or return $self->disconnect; | ||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||
| 222 | elsif (my $default_tube = $self->default_tube) { | ||||||||||||||||||||||||||||
| 223 | 0 | ▶ | $self->use($default_tube) && $self->watch_only($default_tube) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->use($default_tube) and $self->watch_only($default_tube)
MC/DC0%0/2
$self->use($default_tube) and $self->watch_only($default_tube)
$self->use($default_tube)
$self->watch_only($default_tube)
Truth table0%0/3
A and B
A= $self->use($default_tube)B= $self->watch_only($default_tube)
| |||||||||||||||||||||||||||||
| 224 | or return $self->disconnect; | ||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||
| 227 | 0 | ▶ | if (defined $was_using) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 228 | 0 | ▶ | $self->use($was_using) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 229 | or return $self->disconnect; | ||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | 0 | $sock; | |||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||
| 236 | 3 | ▶ | sub disconnect { | ||||||||||||||||||||||||||
|
Subroutine
disconnect: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||
| 237 | 3 | my $self = shift; | |||||||||||||||||||||||||||
| 238 | 3 | ▶ | if (my $sock = $self->socket) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 239 | 0 | close($sock); | |||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||
| 241 | 3 | $self->socket(undef); | |||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | 0 | ▶ | sub quit { | ||||||||||||||||||||||||||
|
Subroutine
quit: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 245 | 0 | shift->disconnect; | |||||||||||||||||||||||||||
| 246 | 0 | return 1; | |||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||
| 250 | 0 | ▶ | sub put { | ||||||||||||||||||||||||||
|
Subroutine
put: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||
| 251 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 252 | 0 | ▶ | my $opt = shift || {}; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || {}
MC/DC0%0/1
shift() || {}
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | 0 | ▶ | my $pri = exists $opt->{priority} ? $opt->{priority} : $self->priority; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 255 | 0 | ▶ | my $ttr = exists $opt->{ttr} ? $opt->{ttr} : $self->ttr; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 256 | 0 | ▶ | my $delay = exists $opt->{delay} ? $opt->{delay} : $self->delay; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 257 | 0 | ▶ | my $data = exists $opt->{data} ? $opt->{data} : $self->encoder->(@_); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | 0 | ▶ | utf8::encode($data) if utf8::is_utf8($data); # need bytes | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||
| 261 | 0 | my $bytes = length($data); | |||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||
| 263 | 0 | ▶ | my @resp = _interact($self, "put $pri $delay $ttr $bytes", $data) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 264 | or return undef; | ||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | 0 | ▶ | if ($resp[0] =~ /( INSERTED | BURIED )/x) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 267 | 0 | ▶ | return Beanstalk::Job->new( | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 268 | { id => $resp[1], | ||||||||||||||||||||||||||||
| 269 | client => $self, | ||||||||||||||||||||||||||||
| 270 | buried => $1 eq 'BURIED' ? 1 : 0, | ||||||||||||||||||||||||||||
| 271 | data => $data, | ||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||
| 273 | ); | ||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | 0 | $self->error(join ' ', @resp); | |||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | 0 | return undef; | |||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||
| 282 | 0 | ▶ | sub stats { | ||||||||||||||||||||||||||
|
Subroutine
stats: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 283 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 284 | 0 | _interact_stats($self, "stats"); | |||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | 0 | ▶ | sub stats_tube { | ||||||||||||||||||||||||||
|
Subroutine
stats_tube: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 289 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 290 | 0 | ▶ | my $tube = @_ ? shift: 'default'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 291 | 0 | _interact_stats($self, "stats-tube $tube"); | |||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||
| 295 | 0 | ▶ | sub stats_job { | ||||||||||||||||||||||||||
|
Subroutine
stats_job: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 296 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 297 | 0 | ▶ | my $id = shift || 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 298 | 0 | _interact_stats($self, "stats-job $id"); | |||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||
| 302 | 0 | ▶ | sub kick { | ||||||||||||||||||||||||||
|
Subroutine
kick: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 303 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 304 | 0 | ▶ | my $bound = shift || 1; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 1
MC/DC0%0/1
shift() || 1
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||
| 306 | 0 | ▶ | my @resp = _interact($self, "kick $bound") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 307 | or return undef; | ||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||
| 309 | 0 | ▶ | return $resp[1] if $resp[0] eq 'KICKED'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | 0 | $self->error(join ' ', @resp); | |||||||||||||||||||||||||||
| 312 | 0 | return undef; | |||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||
| 316 | 0 | ▶ | sub kick_job { | ||||||||||||||||||||||||||
|
Subroutine
kick_job: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 317 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 318 | 0 | my $job = shift; | |||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||
| 320 | 0 | ▶ | my @resp = _interact($self, "kick-job $job") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 321 | or return undef; | ||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | 0 | ▶ | return 1 if $resp[0] eq 'KICKED'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||
| 325 | 0 | $self->error(join ' ', @resp); | |||||||||||||||||||||||||||
| 326 | 0 | return undef; | |||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||
| 330 | 0 | ▶ | sub use { | ||||||||||||||||||||||||||
|
Subroutine
use: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 331 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 332 | 0 | my $tube = shift; | |||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | 0 | ▶ | my @resp = _interact($self, "use $tube") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 335 | or return undef; | ||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||
| 337 | 0 | ▶ | return $self->_using($resp[1]) if $resp[0] eq 'USING'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||
| 339 | 0 | $self->error(join ' ', @resp); | |||||||||||||||||||||||||||
| 340 | 0 | return undef; | |||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||
| 344 | 0 | ▶ | sub reserve { | ||||||||||||||||||||||||||
|
Subroutine
reserve: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 345 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 346 | 0 | my $timeout = shift; | |||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||
| 348 | 0 | ▶ | my $cmd = defined($timeout) ? "reserve-with-timeout $timeout" : "reserve"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 349 | 0 | ▶ | my @resp = _interact($self, $cmd) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 350 | or return undef; | ||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||
| 352 | 0 | ▶ | if ($resp[0] eq 'RESERVED') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 353 | 0 | my $data = _recv_data($self, $resp[2]); | |||||||||||||||||||||||||||
| 354 | 0 | ▶ | return undef unless defined $data; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||
| 356 | 0 | return Beanstalk::Job->new( | |||||||||||||||||||||||||||
| 357 | { id => $resp[1], | ||||||||||||||||||||||||||||
| 358 | client => $self, | ||||||||||||||||||||||||||||
| 359 | reserved => 1, | ||||||||||||||||||||||||||||
| 360 | data => $data, | ||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||
| 362 | ); | ||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||
| 365 | 0 | $self->error(join ' ', @resp); | |||||||||||||||||||||||||||
| 366 | 0 | return undef; | |||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||
| 370 | 0 | ▶ | sub delete { | ||||||||||||||||||||||||||
|
Subroutine
delete: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 371 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 372 | 0 | my $id = shift; | |||||||||||||||||||||||||||
| 373 | 0 | ▶ | my @resp = _interact($self, "delete $id") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 374 | or return undef; | ||||||||||||||||||||||||||||
| 375 | 0 | ▶ | return 1 if $resp[0] eq 'DELETED'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||
| 377 | 0 | $self->error(join ' ', @resp); | |||||||||||||||||||||||||||
| 378 | 0 | return undef; | |||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||
| 381 | 0 | ▶ | sub touch { | ||||||||||||||||||||||||||
|
Subroutine
touch: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 382 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 383 | 0 | my $id = shift; | |||||||||||||||||||||||||||
| 384 | 0 | ▶ | my @resp = _interact($self, "touch $id") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 385 | or return undef; | ||||||||||||||||||||||||||||
| 386 | 0 | ▶ | return 1 if $resp[0] eq 'TOUCHED'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||
| 388 | 0 | $self->error(join ' ', @resp); | |||||||||||||||||||||||||||
| 389 | 0 | return undef; | |||||||||||||||||||||||||||
| 390 | } | ||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||
| 393 | 0 | ▶ | sub release { | ||||||||||||||||||||||||||
|
Subroutine
release: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 394 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 395 | 0 | my $id = shift; | |||||||||||||||||||||||||||
| 396 | 0 | ▶ | my $opt = shift || {}; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || {}
MC/DC0%0/1
shift() || {}
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||
| 398 | 0 | ▶ | my $pri = exists $opt->{priority} ? $opt->{priority} : $self->priority; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 399 | 0 | ▶ | my $delay = exists $opt->{delay} ? $opt->{delay} : $self->delay; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||
| 401 | 0 | ▶ | my @resp = _interact($self, "release $id $pri $delay") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 402 | or return undef; | ||||||||||||||||||||||||||||
| 403 | 0 | ▶ | return 1 if $resp[0] eq 'RELEASED'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||
| 405 | 0 | $self->error(join ' ', @resp); | |||||||||||||||||||||||||||
| 406 | 0 | return undef; | |||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||
| 410 | 0 | ▶ | sub bury { | ||||||||||||||||||||||||||
|
Subroutine
bury: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 411 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 412 | 0 | my $id = shift; | |||||||||||||||||||||||||||
| 413 | 0 | ▶ | my $opt = shift || {}; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || {}
MC/DC0%0/1
shift() || {}
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||
| 415 | 0 | ▶ | my $pri = exists $opt->{priority} ? $opt->{priority} : $self->priority; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||
| 417 | 0 | ▶ | my @resp = _interact($self, "bury $id $pri") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 418 | or return undef; | ||||||||||||||||||||||||||||
| 419 | 0 | ▶ | return 1 if $resp[0] eq 'BURIED'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||
| 421 | 0 | $self->error(join ' ', @resp); | |||||||||||||||||||||||||||
| 422 | 0 | return undef; | |||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||
| 426 | 0 | ▶ | sub watch { | ||||||||||||||||||||||||||
|
Subroutine
watch: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 427 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 428 | 0 | my $tube = shift; | |||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||
| 430 | 0 | ▶ | my $watching = $self->__watching or return undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 431 | 0 | ▶ | return scalar keys %$watching if $watching->{$tube}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||
| 433 | 0 | ▶ | my @resp = _interact($self, "watch $tube") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 434 | or return undef; | ||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||
| 436 | 0 | ▶ | if ($resp[0] eq 'WATCHING') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 437 | 0 | $watching->{$tube}++; | |||||||||||||||||||||||||||
| 438 | 0 | return $resp[1]; | |||||||||||||||||||||||||||
| 439 | } | ||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||
| 441 | 0 | $self->error(join ' ', @resp); | |||||||||||||||||||||||||||
| 442 | 0 | return undef; | |||||||||||||||||||||||||||
| 443 | } | ||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||
| 446 | 0 | ▶ | sub ignore { | ||||||||||||||||||||||||||
|
Subroutine
ignore: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 447 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 448 | 0 | my $tube = shift; | |||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||
| 450 | 0 | ▶ | my $watching = $self->__watching or return undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 451 | 0 | ▶ | return scalar keys %$watching unless $watching->{$tube}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||
| 453 | 0 | ▶ | my @resp = _interact($self, "ignore $tube") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 454 | or return undef; | ||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||
| 456 | 0 | ▶ | if ($resp[0] eq 'WATCHING') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 457 | 0 | delete $watching->{$tube}; | |||||||||||||||||||||||||||
| 458 | 0 | return $resp[1]; | |||||||||||||||||||||||||||
| 459 | } | ||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||
| 461 | 0 | $self->error(join ' ', @resp); | |||||||||||||||||||||||||||
| 462 | 0 | return undef; | |||||||||||||||||||||||||||
| 463 | } | ||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||
| 466 | 0 | ▶ | sub watch_only { | ||||||||||||||||||||||||||
|
Subroutine
watch_only: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||
| 467 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 468 | 0 | ▶ | my $watching = $self->__watching or return undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 469 | 0 | my %watched = %$watching; | |||||||||||||||||||||||||||
| 470 | 0 | my $ret; | |||||||||||||||||||||||||||
| 471 | 0 | foreach my $watch (@_) { | |||||||||||||||||||||||||||
| 472 | 0 | ▶ | next if delete $watched{$watch}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 473 | 0 | ▶ | $ret = $self->watch($watch) or return undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 474 | } | ||||||||||||||||||||||||||||
| 475 | 0 | foreach my $ignore (keys %watched) { | |||||||||||||||||||||||||||
| 476 | 0 | ▶ | $ret = $self->ignore($ignore) or return undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 477 | } | ||||||||||||||||||||||||||||
| 478 | 0 | ▶ | return $ret || scalar keys %$watching; | ||||||||||||||||||||||||||
|
Condition0%0/2
$ret || scalar keys %$watching
MC/DC0%0/1
$ret || scalar keys %$watching
$ret
Truth table0%0/2
A
A= $ret
| |||||||||||||||||||||||||||||
| 479 | } | ||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||
| 482 | 0 | ▶ | sub peek { _peek($_[0], "peek $_[1]") } | ||||||||||||||||||||||||||
|
Subroutine
peek: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 483 | 0 | ▶ | sub peek_ready { _peek(shift, "peek-ready") } | ||||||||||||||||||||||||||
|
Subroutine
peek_ready: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 484 | 0 | ▶ | sub peek_delayed { _peek(shift, "peek-delayed") } | ||||||||||||||||||||||||||
|
Subroutine
peek_delayed: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 485 | 0 | ▶ | sub peek_buried { _peek(shift, "peek-buried") } | ||||||||||||||||||||||||||
|
Subroutine
peek_buried: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||
| 488 | 0 | ▶ | sub list_tubes { | ||||||||||||||||||||||||||
|
Subroutine
list_tubes: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 489 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 490 | 0 | ▶ | my $ret = _interact_yaml_resp($self, "list-tubes") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 491 | or return undef; | ||||||||||||||||||||||||||||
| 492 | 0 | return @$ret; | |||||||||||||||||||||||||||
| 493 | } | ||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||
| 496 | 0 | ▶ | sub list_tube_used { | ||||||||||||||||||||||||||
|
Subroutine
list_tube_used: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 497 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 498 | 0 | ▶ | my @resp = _interact($self, "list-tube-used") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 499 | or return undef; | ||||||||||||||||||||||||||||
| 500 | 0 | ▶ | return $resp[1] if $resp[0] eq 'USING'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||
| 502 | 0 | $self->error(join ' ', @resp); | |||||||||||||||||||||||||||
| 503 | 0 | return undef; | |||||||||||||||||||||||||||
| 504 | } | ||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||
| 507 | 1 | ▶ | sub list_tubes_watched { | ||||||||||||||||||||||||||
|
Subroutine
list_tubes_watched: called CC=2 SCAR=10.1
Pod
documented
| |||||||||||||||||||||||||||||
| 508 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 509 | 1 | ▶ | my $ret = _interact_yaml_resp($self, "list-tubes-watched") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 510 | or return; | ||||||||||||||||||||||||||||
| 511 | 0 | $self->_watching( { map { ($_,1) } @$ret }); | |||||||||||||||||||||||||||
| 512 | 0 | @$ret; | |||||||||||||||||||||||||||
| 513 | } | ||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||
| 516 | 0 | ▶ | sub pause_tube { | ||||||||||||||||||||||||||
|
Subroutine
pause_tube: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 517 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 518 | 0 | my $tube = shift; | |||||||||||||||||||||||||||
| 519 | 0 | ▶ | my $delay= shift || 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 520 | 0 | ▶ | my @resp = _interact($self, "pause-tube $tube $delay") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 521 | or return undef; | ||||||||||||||||||||||||||||
| 522 | 0 | ▶ | return 1 if $resp[0] eq 'PAUSED'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||
| 524 | 0 | $self->error(join ' ', @resp); | |||||||||||||||||||||||||||
| 525 | 0 | return undef; | |||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||
| 528 | 3 | 1; | |||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||
| 530 | __END__ | ||||||||||||||||||||||||||||