Concurrent/Actor.pm untested

filter: Statementstmt 0.0% 0 / 20 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 39 CC 2 SCAR 10.6
CC
2
Cov
0%
new
6.0
is_waiting_for_writable
2.0
is_waiting_for_readable
2.0
CRAP 2.9
1 package IO::Concurrent::Actor;
2 use strict;
3 use warnings;
4  
5 use Carp ();
6  
7 use constant {
8 WRITABLE => 'writable',
9 READABLE => 'readable',
10 };
11  
12 sub new {
13 my ($class, $event_type, $callback) = @_;
14 if ($event_type ne WRITABLE && $event_type ne READABLE) {
15 Carp::croak("invalid event type: $event_type");
16 }
17  
18 return bless {
19 event_type => $event_type,
20 callback => $callback,
21 } => $class;
22 }
23  
24 sub is_waiting_for_writable { shift->{event_type} eq WRITABLE }
25 sub is_waiting_for_readable { shift->{event_type} eq READABLE }
26  
27 sub callback { shift->{callback} }
28  
29 1;
30 __END__