line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package POE::XUL::EventManager; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
2839
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
5
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
71
|
|
6
|
1
|
|
|
1
|
|
6
|
use Scalar::Util qw(weaken); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
7
|
1
|
|
|
1
|
|
483
|
use XUL::Node::Event; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
|
|
|
|
|
|
my $class = shift; |
11
|
|
|
|
|
|
|
bless { nodes => {} }, $class |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub make_event { |
15
|
|
|
|
|
|
|
my ($self, $request) = @_; |
16
|
|
|
|
|
|
|
my $id = $request->{source}; |
17
|
|
|
|
|
|
|
croak "cannot make event with no source" unless $id; |
18
|
|
|
|
|
|
|
$request->{source} = $self->get_node($id); |
19
|
|
|
|
|
|
|
croak "node with id [$id] not found" unless $request->{source}; |
20
|
|
|
|
|
|
|
return XUL::Node::Event->make_event($request); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub fire_event { |
24
|
|
|
|
|
|
|
my ($self, $event) = (shift,shift); |
25
|
|
|
|
|
|
|
$event->source->fire_event($event,@_); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub register_node { |
29
|
|
|
|
|
|
|
my ($self, $id, $node) = @_; |
30
|
|
|
|
|
|
|
my $nodes = $self->{nodes}; |
31
|
|
|
|
|
|
|
$nodes->{$id} = $node; |
32
|
|
|
|
|
|
|
weaken $nodes->{$id}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# TODO: cleanup dangling weak ref now and then |
36
|
|
|
|
|
|
|
sub get_node { shift->{nodes}->{pop()} } |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|