Concurrent/Context.pm untested

filter: Statementstmt 0.0% 0 / 19 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 9 totaltotal 0.0% 0 / 39 CC 1 SCAR 6.9
CC
1
Cov
0%
new
2.0
handler
2.0
error
2.0
CRAP 2.0
1 package IO::Concurrent::Context;
2 use strict;
3 use warnings;
4  
5 sub new {
6 my ($class, $handler, $actors) = @_;
7 return bless {
8 handler => $handler,
9 phase => 0,
10 actors => $actors,
11 error => undef,
12 }, $class;
13 }
14  
15 sub handler { shift->{handler} }
16 sub error { shift->{error} }
17  
18 sub complete { shift->{completed} = 1 }
19 sub is_completed { shift->{completed} }
20  
21 sub abort {
22 my ($self, $err) = @_;
23 $self->{error} = $err;
24 $self->{completed} = 1;
25 }
26  
27 sub next :method { shift->{phase}++ }
28 sub back { shift->{phase}-- }
29  
30 sub current_actor { $_[0]->{actors}->[$_[0]->{phase}] }
31  
32 1;
33 __END__