line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package POE::Event; |
2
|
|
|
|
|
|
|
|
3
|
110
|
|
|
110
|
|
554
|
use strict; |
|
110
|
|
|
|
|
322
|
|
|
110
|
|
|
|
|
4711
|
|
4
|
110
|
|
|
110
|
|
551
|
use POE::Callstack qw(POP PUSH); |
|
110
|
|
|
|
|
217
|
|
|
110
|
|
|
|
|
7076
|
|
5
|
|
|
|
|
|
|
|
6
|
110
|
|
|
110
|
|
56521
|
use HOE; |
|
110
|
|
|
|
|
326
|
|
|
110
|
|
|
|
|
10202
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
BEGIN { |
9
|
110
|
|
|
110
|
|
553
|
our @_ELEMENTS = qw(KERNEL TIME FROM TO NAME ARGS); |
10
|
110
|
|
|
|
|
120
|
my $i = 0; |
11
|
110
|
|
|
|
|
328
|
foreach my $element (@_ELEMENTS) { |
12
|
660
|
|
|
|
|
22793
|
eval "sub $element () { $i }"; |
13
|
660
|
|
|
|
|
18321
|
$i++; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
unless( exists( $ENV{HOE_NOXS} ) and $ENV{HOE_NOXS} ) { |
18
|
|
|
|
|
|
|
eval { |
19
|
|
|
|
|
|
|
require XSLoader; |
20
|
|
|
|
|
|
|
local $^W = 0; |
21
|
|
|
|
|
|
|
XSLoader::load('HOE', $HOE::XS_VERSION); |
22
|
|
|
|
|
|
|
} or warn( "XS Failed to load: $@\n" ); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
else { |
25
|
|
|
|
|
|
|
warn( "Skipping HOE XS load via environment HOE_NOXS=$ENV{HOE_NOXS}\n" ); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
use overload ( |
29
|
|
|
|
|
|
|
"<=>" => sub { |
30
|
684
|
|
|
684
|
|
7425
|
return $_[0]->[TIME] <=> $_[1]->[TIME]; |
31
|
|
|
|
|
|
|
}, |
32
|
110
|
|
|
|
|
1107
|
fallback => 1, |
33
|
110
|
|
|
110
|
|
237869
|
); |
|
110
|
|
|
|
|
137657
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub DEBUG { |
36
|
0
|
|
|
0
|
0
|
0
|
print @_; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub DEBUGGING () { 0 } |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub new { |
42
|
|
|
|
|
|
|
# my $class = shift; |
43
|
|
|
|
|
|
|
# my $kernel = shift; |
44
|
|
|
|
|
|
|
# my $when = shift; |
45
|
|
|
|
|
|
|
# my $from = shift; |
46
|
|
|
|
|
|
|
# my $to = shift; # Resolution does nasty things, figure out where it belongs later (used to be here) |
47
|
|
|
|
|
|
|
# my $name = shift; |
48
|
|
|
|
|
|
|
# my $args = shift; |
49
|
|
|
|
|
|
|
|
50
|
924
|
|
33
|
924
|
0
|
27485
|
return bless [ |
51
|
|
|
|
|
|
|
$_[1], # KERNEL |
52
|
|
|
|
|
|
|
$_[2], # TIME |
53
|
|
|
|
|
|
|
$_[3], # FROM |
54
|
|
|
|
|
|
|
$_[1]->resolve_session( $_[4] ), # TO |
55
|
|
|
|
|
|
|
$_[5], # NAME |
56
|
|
|
|
|
|
|
$_[6], # ARGS |
57
|
|
|
|
|
|
|
], (ref $_[0] || $_[0]); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub dispatch { |
61
|
|
|
|
|
|
|
my $self = shift; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
my $return; |
64
|
|
|
|
|
|
|
my @return; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
my $wantarray = wantarray; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
{ # Wrap this baby in a magical scope so destruction happens in a timely manner... yes |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
#my $to = $self->[KERNEL]->resolve_session( $self->[TO] ); |
71
|
|
|
|
|
|
|
my $to = $self->[TO]; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
DEBUG "[DISPATCH] Event dispatching From: $self->[FROM] To: $to Event: $self->[NAME]\n" if DEBUGGING; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# push inside, so we know the $to |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
PUSH( $to, $self->[NAME] ); |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
if (defined( $wantarray )) { |
80
|
|
|
|
|
|
|
if ($wantarray) { |
81
|
|
|
|
|
|
|
@return = $to->_invoke_state( $self->[FROM], $self->[NAME], $self->[ARGS] ); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
else { |
84
|
|
|
|
|
|
|
$return = $to->_invoke_state( $self->[FROM], $self->[NAME], $self->[ARGS] ); |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
else { |
88
|
|
|
|
|
|
|
$to->_invoke_state( $self->[FROM], $self->[NAME], $self->[ARGS] ); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
# Magic scope manipulation, destruct all the related things while we are still |
92
|
|
|
|
|
|
|
# in teh context of a session (before POP) |
93
|
|
|
|
|
|
|
@$self = (); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
# Pop outside, so we know that as much destruction as possible has happened |
97
|
|
|
|
|
|
|
POP; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
if (defined( $wantarray )) { |
100
|
|
|
|
|
|
|
if ($wantarray) { |
101
|
|
|
|
|
|
|
return @return; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
else { |
104
|
|
|
|
|
|
|
return $return; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
else { |
108
|
|
|
|
|
|
|
return; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub when { |
113
|
352
|
|
|
352
|
0
|
690
|
my $self = shift; |
114
|
352
|
|
|
|
|
8091
|
return $self->[TIME]; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub from { |
118
|
300
|
|
|
300
|
0
|
647
|
my $self = shift; |
119
|
300
|
|
|
|
|
801
|
return $self->[FROM]; |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub name { |
123
|
300
|
|
|
300
|
0
|
518
|
my $self = shift; |
124
|
300
|
|
|
|
|
997
|
return $self->[NAME]; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub args { |
128
|
1
|
|
|
1
|
0
|
2
|
my $self = shift; |
129
|
1
|
50
|
|
|
|
5
|
if (wantarray) { |
130
|
1
|
|
|
|
|
2
|
return @{$self->[ARGS]}; |
|
1
|
|
|
|
|
4
|
|
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
else { |
133
|
0
|
|
|
|
|
|
return $self->[ARGS]; |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
1; |