line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SDLx::Controller::Coro; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
SDLx::Controller::Coro - Event loop with Coro yummyness |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use SDLx::Controller::Coro; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# More info coming soon! |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 DESCRIPTION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
This module builds off of L, bringing Coro into the |
16
|
|
|
|
|
|
|
event loop so that async events and routines will be processed. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
39166
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
21
|
1
|
|
|
1
|
|
5
|
use base 'SDLx::Controller'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
811
|
|
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
1
|
|
238055
|
use EV; |
|
1
|
|
|
|
|
5989
|
|
|
1
|
|
|
|
|
33
|
|
24
|
1
|
|
|
1
|
|
582
|
use AnyEvent; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use Coro; |
26
|
|
|
|
|
|
|
AnyEvent::detect; # Force AnyEvent to integrate Coro into EV |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _event { |
31
|
|
|
|
|
|
|
my $self = shift; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
$self->SUPER::_event(@_); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# Give other AnyEvent/Coro/EV things a shot |
36
|
|
|
|
|
|
|
yield(); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub run { |
40
|
|
|
|
|
|
|
my $self = shift; |
41
|
|
|
|
|
|
|
async { $self->SUPER::run(@_); }; |
42
|
|
|
|
|
|
|
EV::loop(); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
use Coro::AnyEvent; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub yield { |
48
|
|
|
|
|
|
|
#Coro::AnyEvent::poll(); |
49
|
|
|
|
|
|
|
Coro::AnyEvent::idle_upto(0.01); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|