line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooseX::POE::Role; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$MooseX::POE::Role::VERSION = '0.215'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
# ABSTRACT: Eventful roles |
6
|
1
|
|
|
1
|
|
26562
|
use MooseX::POE::Meta::Role; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use Moose::Exporter; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my ( $import, $unimport, $init_meta ) = Moose::Exporter->setup_import_methods( |
11
|
|
|
|
|
|
|
with_caller => [qw(event)], |
12
|
|
|
|
|
|
|
also => 'Moose::Role', |
13
|
|
|
|
|
|
|
install => [qw(import unimport)], |
14
|
|
|
|
|
|
|
role_metaroles => { |
15
|
|
|
|
|
|
|
role => ['MooseX::POE::Meta::Role'], |
16
|
|
|
|
|
|
|
}, |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub init_meta { |
20
|
|
|
|
|
|
|
my ( $class, %args ) = @_; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my $for = $args{for_class}; |
23
|
|
|
|
|
|
|
eval qq{package $for; use POE; }; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Moose::Role->init_meta( for_class => $for ); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
goto $init_meta; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub event { |
31
|
|
|
|
|
|
|
my ( $caller, $name, $method ) = @_; |
32
|
|
|
|
|
|
|
my $class = Moose::Meta::Class->initialize($caller); |
33
|
|
|
|
|
|
|
$class->add_state_method( $name => $method ); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=pod |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 NAME |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
MooseX::POE::Role - Eventful roles |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 VERSION |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
version 0.215 |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 SYNOPSIS |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
package Counter; |
53
|
|
|
|
|
|
|
use MooseX::POE::Role; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
... |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
package RealCounter; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
with qw(Counter); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 DESCRIPTION |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
This is what L<MooseX::POE> is to Moose but with L<Moose::Role>. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 METHODS |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 event $name $subref |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Create an event handler named $name. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 KEYWORDS |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=for :list * L<MooseX::POE|MooseX::POE> |
74
|
|
|
|
|
|
|
* L<Moose::Role> |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 AUTHORS |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=over 4 |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item * |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Chris Prather <chris@prather.org> |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item * |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Ash Berlin <ash@cpan.org> |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item * |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Chris Williams <chris@bingosnet.co.uk> |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item * |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Yuval (nothingmuch) Kogman |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item * |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Torsten Raudssus <torsten@raudssus.de> L<http://www.raudssus.de/> |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=back |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
This software is copyright (c) 2010 by Chris Prather, Ash Berlin, Chris Williams, Yuval Kogman, Torsten Raudssus. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
107
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=cut |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
__END__ |
113
|
|
|
|
|
|
|
|