SmokeBox/JobQueue.pm

filter: Statementstmt 75.4% 157 / 208 Branchbran 61.1% 55 / 90 Conditioncond 50.0% 13 / 26 MC/DCmcdc 33.3% 5 / 15 Subroutinesub 81.8% 27 / 33 Podpod 100% 11 / 11 totaltotal 69.9% 268 / 383 SCAR 50.6
CC
59
Cov
69%
_remove_job
90.0
_cancel
20.0
_process_queue
14.0
CRAP 158.3
« SmokeBox/Backend.pm ↑ Summary SmokeBox.pm »
1 package POE::Component::SmokeBox::JobQueue;
2 21 $POE::Component::SmokeBox::JobQueue::VERSION = '0.56';
3 #ABSTRACT: An array based queue for SmokeBox
4  
5 21 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 21 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 21 ▶use POE qw(Component::SmokeBox::Backend Component::SmokeBox::Job Component::SmokeBox::Smoker Component::SmokeBox::Result);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 21 ▶use Params::Check qw(check);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 # Stolen from POE::Wheel. This is static data, shared by all
11 21 my $current_id = 0;
12 21 my %active_identifiers;
13  
14 sub spawn {
15 24 ▶ my $package = shift;
Subroutine spawn: called CC=4 SCAR=13.9
Pod documented
16 24 my %params = @_;
17 24 $params{lc $_} = delete $params{$_} for keys %params;
18 24 ▶ $params{'delay'} = 0 unless exists $params{'delay'};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $params{"delay"} 7 17 24
19 24 my $options = delete $params{'options'};
20 24 my $self = bless \%params, $package;
21 24 ▶ $self->{session_id} = POE::Session->create(
Branch: 1 branch
BranchTrueFalseTotal
ref $options eq 'HASH' ? : 1 23 24
22 object_states => [
23 $self => {
24 'shutdown' => '_shutdown',
25 submit => '_submit',
26 cancel => '_cancel',
27 },
28 $self => [qw(_start _process_queue _backend_done _process_queue_delayed)],
29 ],
30 heap => $self,
31 ( ref($options) eq 'HASH' ? ( options => $options ) : () ),
32 )->ID();
33 24 return $self;
34 }
35  
36 sub session_id {
37 74 ▶ return $_[0]->{session_id};
Subroutine session_id: called CC=1 SCAR=0.0
Pod documented
38 }
39  
40 sub shutdown {
41 24 ▶ my $self = shift;
Subroutine shutdown: called CC=1 SCAR=0.0
Pod documented
42 24 $poe_kernel->call( $self->session_id() => 'shutdown' => @_ );
43 }
44  
45 sub _start {
46 24 ▶ my ($kernel,$self) = @_[KERNEL,OBJECT];
Subroutine _start: called CC=2 SCAR=7.1
47 24 $self->{session_id} = $_[SESSION]->ID();
48 24 ▶ if ( $self->{alias} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'alias'}) { } 0 24 24
49 0 $kernel->alias_set( $self->{alias} );
50 }
51 else {
52 24 $kernel->refcount_increment( $self->{session_id} => __PACKAGE__ );
53 }
54 24 $self->{_queue} = [ ];
55 24 return;
56 }
57  
58 sub _shutdown {
59 24 ▶ my ($kernel,$self) = @_[KERNEL,OBJECT];
Subroutine _shutdown: called CC=6 SCAR=18.0
60 24 $self->{_shutdown} = 1;
61 24 ▶ if ( $self->{alias} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'alias'}) { } 0 24 24
62 0 $kernel->alias_remove($_) for $kernel->alias_list();
63 }
64 else {
65 24 $kernel->refcount_decrement( $self->{session_id} => __PACKAGE__ );
66 }
67 # shutdown currently running backend
68 24 ▶ $self->{_current}->{backend}->shutdown() if $self->{_current}->{backend};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_current"}{"backend"} 1 23 24
69 # remove queued jobs.
70 # $kernel->refcount_decrement( $_->{session}, __PACKAGE__ ) for @{ $self->{_queue} };
71 24 $kernel->refcount_decrement( $_, __PACKAGE__ ) for keys %{ $self->{_refcounts} };
72 24 delete $self->{_queue};
73  
74 # remove delay for jobs if we set one
75 24 ▶ $kernel->alarm_remove( delete $self->{_delay} ) if exists $self->{_delay};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"_delay"} 2 22 24
76  
77 24 return;
78 }
79  
80 sub _process_queue_delayed {
81 8 ▶ my ($kernel,$self) = @_[KERNEL,OBJECT];
Subroutine _process_queue_delayed: called CC=2 SCAR=7.0
82 8 ▶ delete $self->{_delay} if exists $self->{_delay};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"_delay"} 8 0 8
83 8 $kernel->yield( '_process_queue', 'DELAYDONE' );
84 8 return;
85 }
86  
87 sub _process_queue {
88 192 ▶ my ($kernel,$self,$delaydone) = @_[KERNEL,OBJECT,ARG0];
Subroutine _process_queue: called CC=14 SCAR=26.4
89 192 ▶ return if $self->{_shutdown};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_shutdown"} 3 189 192
90 189 ▶ return if exists $self->{_delay};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"_delay"} 0 189 189
91 189 ▶ return if exists $self->{paused} and $self->{paused} == 2;
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"paused"} and $self->{"paused"} == 2 2 187 189
Condition100%3/3
exists $self->{"paused"} and $self->{"paused"} == 2
!ll&&!rl&&r
18252
MC/DC100%2/2
exists $self->{"paused"} and $self->{"paused"} == 2
exists $self->{"paused"} $self->{"paused"} == 2
Truth table100%3/3
A and B
A= exists $self->{"paused"}B= $self->{"paused"} == 2
ABresult
0X0
100
111
92 187 my ($job, $smoker );
93 187 ▶ if ( $self->{_current} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_current'}) { } 116 71 187
94 116 ▶ return if $self->{_current}->{backend};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_current"}{"backend"} 27 89 116
95 89 $job = $self->{_current};
96  
97 # do we have a delay between smokers?
98 89 ▶ if ( $job->{job}->delay > 0 and ! defined $delaydone and scalar @{ $job->{smokers} } > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($job->{"job"}->delay > 0 and not defined $delaydone and scalar @{$job->{"smokers"};} > 0) 6 83 89
Condition100%6/6
$job->{"job"}->delay > 0 and not defined $delaydone and scalar @{$job->{"smokers"};} > 0
!ll&&!rl&&r
8036
$job->{"job"}->delay > 0 and not defined $delaydone
!ll&&!rl&&r
7469
MC/DC100%3/3
$job->{"job"}->delay > 0 and not defined $delaydone and scalar @{$job->{"smokers"};} > 0
$job->{"job"}->delay > 0 not defined $delaydone scalar @{$job->{"smokers"};} > 0
Truth table100%4/4
A and not(B) and C
A= $job->{"job"}->delay > 0B= not defined $delaydoneC= scalar @{$job->{"smokers"};} > 0
ABCresult
0XX0
10X0
1100
1111
99 # fire off an alarm for the next iteration
100 #warn "Setting delay(" . $job->{job}->delay . ") for smoker" if $ENV{PERL5_SMOKEBOX_DEBUG};
101 6 $self->{_delay} = $kernel->delay_set( '_process_queue_delayed' => $job->{job}->delay );
102 6 return;
103 }
104  
105 83 $smoker = shift @{ $job->{smokers} };
106 83 ▶ unless ( $smoker ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($smoker) 49 34 83
107 # Reached the end send an event back to the original requestor
108 49 delete $self->{_current};
109 49 delete $job->{smokers};
110 49 my $session = delete $job->{session};
111 49 $kernel->post( $session, delete $job->{event}, $job );
112 49 $self->{_refcounts}->{ $session }--;
113 49 ▶ if ( $self->{_refcounts}->{ $session } <= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_refcounts"}{$session} <= 0) 22 27 49
114 22 $kernel->refcount_decrement( $session, __PACKAGE__ );
115 22 delete $self->{_refcounts}->{ $session };
116 }
117  
118 # did we enable delay between jobs?
119 # don't check the queue, we force a delay all the time so if we add a job, we're already delaying for it...
120 49 ▶ if ( $self->{delay} > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'delay'} > 0) { } 4 45 49
121 # fire off an alarm for the next iteration
122 #warn "Setting delay($self->{delay}) for job" if $ENV{PERL5_SMOKEBOX_DEBUG};
123 4 $self->{_delay} = $kernel->delay_set( '_process_queue_delayed' => $self->{delay} );
124 } else {
125 45 $kernel->yield( '_process_queue' );
126 }
127 49 return;
128 }
129 }
130 else {
131 71 $job = $self->_shift();
132 71 ▶ return unless $job;
Branch: 1 branch
BranchTrueFalseTotal
unless $job 21 50 71
133 50 $smoker = shift @{ $job->{smokers} };
134 50 $job->{result} = POE::Component::SmokeBox::Result->new();
135 50 $self->{_current} = $job;
136 }
137 84 $job->{backend} = POE::Component::SmokeBox::Backend->spawn( event => '_backend_done', $job->{job}->dump_data(), $smoker->dump_data(), );
138 84 return;
139 }
140  
141 sub _backend_done {
142 84 ▶ my ($kernel,$self,$result) = @_[KERNEL,OBJECT,ARG0];
Subroutine _backend_done: called CC=1 SCAR=0.0
143 84 delete $self->{_current}->{backend};
144 84 $self->{_current}->{result}->add_result( $result );
145 84 $kernel->yield( '_process_queue' );
146 84 return;
147 }
148  
149 sub submit {
150 51 ▶ my $self = shift;
Subroutine submit: called CC=1 SCAR=0.0
Pod documented
151 51 return $poe_kernel->call( $self->{session_id}, 'submit', @_ );
152 }
153  
154 sub cancel {
155 0 ▶ my $self = shift;
Subroutine cancel: not called CC=1 SCAR=6.9
Pod documented
156 0 return $poe_kernel->call( $self->{session_id}, 'cancel', @_ );
157 }
158  
159 sub _submit {
160 51 ▶ my ($kernel,$self,$sender) = @_[KERNEL,OBJECT,SENDER];
Subroutine _submit: called CC=8 SCAR=21.3
161 51 ▶ return if $self->{_shutdown};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_shutdown"} 0 51 51
162 51 my $args;
163 51 ▶ if ( ref( $_[ARG0] ) eq 'HASH' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_[10] eq 'HASH') { } 44 7 51
164 44 $args = { %{ $_[ARG0] } };
165 }
166 else {
167 7 $args = { @_[ARG0..$#_] };
168 }
169  
170 my $tmpl = {
171 event => { required => 1, defined => 1, },
172 44 ▶ session => { defined => 1, allow => [ sub { return 1 if $poe_kernel->alias_resolve( $_[0] ); }, ], },
Subroutine __ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
if $POE::Component::SmokeBox::JobQueue::poe_kernel->alias_resolve($_[0]) 44 0 44
173 type => { defined => 1, allow => [qw(push unshift)], default => 'push', },
174 job => { required => 1, defined => 1,
175 50 ▶ allow => [ sub { return 1 if ref $_[0] and $_[0]->isa('POE::Component::SmokeBox::Job'); }, ], },
Subroutine __ANON__: called CC=3 SCAR=14.2
Branch: 1 branch
BranchTrueFalseTotal
if ref $_[0] and $_[0]->isa("POE::Component::SmokeBox::Job") 50 0 50
Condition33%1/3
ref $_[0] and $_[0]->isa("POE::Component::SmokeBox::Job")
!ll&&!rl&&r
0050
MC/DC0%0/2
ref $_[0] and $_[0]->isa("POE::Component::SmokeBox::Job")
ref $_[0] $_[0]->isa("POE::Component::SmokeBox::Job")
Truth table33%1/3
A and B
A= ref $_[0]B= $_[0]->isa("POE::Component::SmokeBox::Job")
ABresult
0X0
100
111
176 smokers => { required => 1, defined => 1, allow => [
177 sub {
178 return 1 if ref $_[0] eq 'ARRAY'
179 50 and scalar @{ $_[0] }
180 50 ▶ and ( grep { $_->isa('POE::Component::SmokeBox::Smoker') } @{ $_[0] } ) == @{ $_[0] };
Subroutine __ANON__: called CC=4 SCAR=15.6
Branch: 1 branch
BranchTrueFalseTotal
if ref $_[0] eq "ARRAY" and scalar @{$_[0];} and grep({$_->isa("POE::Component::SmokeBox::Smoker");} @{$_[0];}) == @{$_[0];} 50 0 50
Condition40%2/5
ref $_[0] eq "ARRAY" and scalar @{$_[0];} and grep({$_->isa("POE::Component::SmokeBox::Smoker");} @{$_[0];}) == @{$_[0];}
!ll&&!rl&&r
0050
ref $_[0] eq "ARRAY" and scalar @{$_[0];}
!ll
050
MC/DC0%0/2
ref $_[0] eq "ARRAY" and scalar @{$_[0];} and grep({$_->isa("POE::Component::SmokeBox::Smoker");} @{$_[0];}) == @{$_[0];}
ref $_[0] eq "ARRAY" grep({$_->isa("POE::Component::SmokeBox::Smoker");} @{$_[0];}) == @{$_[0];}
Truth table33%1/3
A and B
A= ref $_[0] eq "ARRAY"B= grep({$_->isa("POE::Component::SmokeBox::Smoker");} @{$_[0];}) == @{$_[0];}
ABresult
0X0
100
111
181 51 }, ],
182 },
183  
184 };
185  
186 51 ▶ my $checked = check( $tmpl, $args, 1 ) or return;
Branch: 1 branch
BranchTrueFalseTotal
my $checked = check($tmpl, $args, 1) or return 1 50 51
187 50 ▶ $checked->{session} = $kernel->alias_resolve( $checked->{session} )->ID() if $checked->{session};
Branch: 1 branch
BranchTrueFalseTotal
if $checked->{"session"} 44 6 50
188 50 ▶ $checked->{session} = $sender->ID() unless $checked->{session};
Branch: 1 branch
BranchTrueFalseTotal
unless $checked->{"session"} 6 44 50
189 50 my $type = delete $checked->{type};
190 50 my $id = $self->_add_job( $checked, $type );
191 50 ▶ return unless $id;
Branch: 1 branch
BranchTrueFalseTotal
unless $id 0 50 50
192 50 ▶ unless ( defined $self->{_refcounts}->{ $checked->{session} } ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_refcounts"}{$checked->{"session"}}) 23 27 50
193 23 $kernel->refcount_increment( $checked->{session}, __PACKAGE__ );
194 }
195 50 $self->{_refcounts}->{ $checked->{session} }++;
196 50 $checked->{submitted} = time();
197 #$checked->{job}->id( $id );
198 50 return $id;
199 }
200  
201 sub _cancel {
202 0 ▶ my ($kernel,$self,$sender) = @_[KERNEL,OBJECT,SENDER];
Subroutine _cancel: not called CC=4 SCAR=30.0
203 0 ▶ return if $self->{_shutdown};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_shutdown"} 0 0 0
204 0 my $args;
205 0 ▶ if ( ref( $_[ARG0] ) eq 'HASH' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_[10] eq 'HASH') { } 0 0 0
206 0 $args = { %{ $_[ARG0] } };
207 }
208 else {
209 0 $args = { @_[ARG0..$#_] };
210 }
211  
212 0 my $tmpl = {
213 job => { required => 1, defined => 1, },
214 };
215  
216 0 ▶ my $checked = check( $tmpl, $args, 1 ) or return;
Branch: 1 branch
BranchTrueFalseTotal
my $checked = check($tmpl, $args, 1) or return 0 0 0
217 0 return $self->_remove_job( $checked->{job} );
218 }
219  
220 sub _push {
221 50 ▶ my ($self,$job) = @_;
Subroutine _push: called CC=2 SCAR=6.9
222 50 ▶ return unless ref $job eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $job eq "HASH" 0 50 50
223 50 my $id = _allocate_identifier();
224 50 $job->{id} = $id;
225 50 CORE::push @{ $self->{_queue} }, $job;
226 50 $self->{_jobs}->{ $id } = $job;
227 50 $poe_kernel->post( $self->session_id(), '_process_queue' );
228 50 return $id;
229 }
230  
231 sub _unshift {
232 0 ▶ my ($self,$job) = @_;
Subroutine _unshift: not called CC=2 SCAR=17.9
233 0 ▶ return unless ref $job eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $job eq "HASH" 0 0 0
234 0 my $id = _allocate_identifier();
235 0 $job->{id} = $id;
236 0 CORE::unshift @{ $self->{_queue} }, $job;
237 0 $self->{_jobs}->{ $id } = $job;
238 0 $poe_kernel->post( $self->session_id(), '_process_queue' );
239 0 return $id;
240 }
241  
242 sub _shift {
243 71 ▶ my $self = CORE::shift;
Subroutine _shift: called CC=3 SCAR=11.0
244 71 ▶ return if $self->{paused};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"paused"} 3 68 71
245 68 my $job = CORE::shift @{ $self->{_queue} };
246 68 ▶ return unless $job;
Branch: 1 branch
BranchTrueFalseTotal
unless $job 18 50 68
247 50 delete $self->{_jobs}->{ $job->{id} };
248 50 _free_identifier( $job->{id} );
249 50 delete $job->{id};
250 50 return $job;
251 }
252  
253 sub _pop {
254 0 ▶ my $self = CORE::shift;
Subroutine _pop: not called CC=3 SCAR=24.8
255 0 ▶ return if $self->{paused};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"paused"} 0 0 0
256 0 my $job = CORE::pop @{ $self->{_queue} };
257 0 ▶ return unless $job;
Branch: 1 branch
BranchTrueFalseTotal
unless $job 0 0 0
258 0 delete $self->{_jobs}->{ $job->{id} };
259 0 _free_identifier( $job->{id} );
260 0 delete $job->{id};
261 0 return $job;
262 }
263  
264 sub _add_job {
265 50 ▶ my ($self,$job,$type) = @_;
Subroutine _add_job: called CC=4 SCAR=15.5
266 50 ▶ $type = lc $type if $type;
Branch: 1 branch
BranchTrueFalseTotal
if $type 50 0 50
267 50 ▶ if ( $type and grep { /^\Q$type\E$/ } qw(push unshift) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type and grep {/^\Q$type\E$/;} "push", "unshift") 50 0 50
Condition33%1/3
$type and grep {/^\Q$type\E$/;} "push", "unshift"
!ll&&!rl&&r
0050
MC/DC0%0/2
$type and grep {/^\Q$type\E$/;} "push", "unshift"
$type grep {/^\Q$type\E$/;} "push", "unshift"
Truth table33%1/3
A and B
A= $typeB= grep {/^\Q$type\E$/;} "push", "unshift"
ABresult
0X0
100
111
268 50 $type = '_' . $type;
269 50 return $self->$type( $job );
270 }
271 0 return $self->_push( $job );
272 }
273  
274 sub _remove_job {
275 0 ▶ my ($self,$type) = @_;
Subroutine _remove_job: not called CC=9 SCAR=45.0
276 0 ▶ return if $self->{paused};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"paused"} 0 0 0
277 0 ▶ $type = lc $type if $type;
Branch: 1 branch
BranchTrueFalseTotal
if $type 0 0 0
278 0 ▶ if ( $type and grep { /^\Q$type\E$/ } qw(pop shift) ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($type and grep {/^\Q$type\E$/;} 'pop', 'shift') { } 0 0 0
elsif ($type and defined $self->{'_jobs'}{$type}) { } 0 0 0
Condition0%0/3
$type and grep {/^\Q$type\E$/;} "pop", "shift"
!ll&&!rl&&r
000
MC/DC0%0/2
$type and grep {/^\Q$type\E$/;} "pop", "shift"
$type grep {/^\Q$type\E$/;} "pop", "shift"
Truth table0%0/3
A and B
A= $typeB= grep {/^\Q$type\E$/;} "pop", "shift"
ABresult
0X0
100
111
279 0 $type = '_' . $type;
280 0 return $self->$type();
281 }
282 ▶ elsif ( $type and defined $self->{_jobs}->{ $type } ) {
Condition0%0/3
$type and defined $self->{"_jobs"}{$type}
!ll&&!rl&&r
000
MC/DC0%0/2
$type and defined $self->{"_jobs"}{$type}
$type defined $self->{"_jobs"}{$type}
Truth table0%0/3
A and B
A= $typeB= defined $self->{"_jobs"}{$type}
ABresult
0X0
100
111
283 0 my $job = delete $self->{_jobs}->{ $type };
284 0 my $i = 0;
285 0 for ( @{ $self->{_queue} } ) {
286 0 ▶ splice(@{ $self->{_queue} }, $i, 1) if $_->{id} eq $type;
Branch: 1 branch
BranchTrueFalseTotal
if $_->{"id"} eq $type 0 0 0
287 0 ++$i;
288 }
289 0 delete $job->{id};
290 }
291 0 return $self->_shift();
292 }
293  
294 sub pending_jobs {
295 11 ▶ my $self = CORE::shift;
Subroutine pending_jobs: called CC=1 SCAR=0.0
Pod documented
296 11 return @{ $self->{_queue} };
297 }
298  
299 sub pause_queue {
300 3 ▶ my $self = CORE::shift;
Subroutine pause_queue: called CC=1 SCAR=0.0
Pod documented
301 3 $self->{paused} = 1;
302 }
303  
304 sub pause_queue_now {
305 2 ▶ my $self = CORE::shift;
Subroutine pause_queue_now: called CC=1 SCAR=0.0
Pod documented
306 2 $self->{paused} = 2;
307 }
308  
309 sub resume_queue {
310 5 ▶ my $self = CORE::shift;
Subroutine resume_queue: called CC=1 SCAR=0.0
Pod documented
311 5 delete $self->{paused};
312 5 $poe_kernel->post( $self->{session_id}, '_process_queue' );
313 }
314  
315 sub queue_paused {
316 20 ▶ if ( exists $_[0]->{paused} ) {
Subroutine queue_paused: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if (exists $_[0]{'paused'}) { } 9 11 20
317 9 return 1;
318 } else {
319 11 return 0;
320 }
321 }
322  
323 sub current_job {
324 0 ▶ my $self = CORE::shift;
Subroutine current_job: not called CC=1 SCAR=6.9
Pod documented
325 0 return $self->{_current};
326 }
327  
328 sub _allocate_identifier {
329 50 ▶ while (1) {
Subroutine _allocate_identifier: called CC=2 SCAR=7.1
330 50 ▶ last unless exists $active_identifiers{ ++$current_id };
Branch: 1 branch
BranchTrueFalseTotal
unless exists $active_identifiers{++$current_id} 50 0 50
331 }
332 50 return $active_identifiers{$current_id} = $current_id;
333 }
334  
335 sub _free_identifier {
336 50 ▶ my $id = CORE::shift;
Subroutine _free_identifier: called CC=1 SCAR=0.0
337 50 delete $active_identifiers{$id};
338 }
339  
340 21 1;
341  
342 __END__
« SmokeBox/Backend.pm ↑ Summary SmokeBox.pm »