forked from bingos/throwaway
-
Notifications
You must be signed in to change notification settings - Fork 2
/
mxwtf.pl
71 lines (55 loc) · 1.24 KB
/
mxwtf.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
use Test::More tests => 3;
package mxpoe;
use MooseX::POE;
use MooseX::AttributeHelpers;
use Test::More;
sub START {
my ($kernel,$self) = @_[KERNEL,OBJECT];
diag "Starting .... \n";
diag("$_\n") for $self->meta->get_all_events;
$kernel->yield( 'counter_event' );
return;
}
event 'counter_event' => sub {
my ($kernel,$self) = @_[KERNEL,OBJECT];
pass('Got a counter event');
return;
};
no MooseX::POE;
__PACKAGE__->meta->make_immutable;
package mxpoet;
use MooseX::POE;
use Test::More;
extends 'mxpoe';
sub START {
my ($kernel,$self) = @_[KERNEL,OBJECT];
diag("$_\n") for $self->meta->get_all_events;
diag "Starting EXTENSION .... \n";
$kernel->yield( 'counter_event' );
$kernel->yield( 'rounter_event' );
return;
}
event 'rounter_event' => sub {
my ($kernel,$self) = @_[KERNEL,OBJECT];
pass('Got a counter event');
return;
};
event 'counter_event' => sub {
my ($kernel,$self) = @_[KERNEL,OBJECT];
pass('Got a counter event');
return;
};
no MooseX::POE;
__PACKAGE__->meta->make_immutable;
package main;
use strict;
use warnings;
use Test::More;
use POE;
use POE::API::Peek;
use Data::Dumper;
my $mxpoe = mxpoet->new();
my $events = POE::API::Peek->new()->event_list();
diag(Dumper($events));
$poe_kernel->run();
exit 0;