line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package IO::Concurrent; |
2
|
1
|
|
|
1
|
|
576
|
use 5.008001; |
|
1
|
|
|
|
|
3
|
|
3
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
16
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = "0.01"; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
331
|
use IO::Concurrent::Runner; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
139
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
0
|
|
|
0
|
0
|
|
my ($class, %args) = @_; |
12
|
0
|
|
0
|
|
|
|
$args{engine} ||= 'Select'; |
13
|
0
|
|
|
|
|
|
return bless \%args => $class; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub run { |
17
|
0
|
|
|
0
|
0
|
|
my ($self, $scenario) = @_; |
18
|
0
|
|
|
|
|
|
my @contexts = map { $scenario->create_context($_) } @{ $self->{handlers} }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
my $runner = $self->_create_runner(\@contexts, { |
20
|
|
|
|
|
|
|
on_error => $scenario->on_error, |
21
|
|
|
|
|
|
|
}); |
22
|
0
|
|
|
|
|
|
$runner->run(); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _create_runner { |
26
|
0
|
|
|
0
|
|
|
my $self = shift; |
27
|
0
|
|
|
|
|
|
return IO::Concurrent::Runner->engine($self->{engine})->new(@_); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
__END__ |