| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package MouseX::POE::Meta::Trait::Object; |
|
2
|
|
|
|
|
|
|
BEGIN { |
|
3
|
11
|
|
|
11
|
|
12922
|
$MouseX::POE::Meta::Trait::Object::VERSION = '0.214'; |
|
4
|
|
|
|
|
|
|
} |
|
5
|
|
|
|
|
|
|
# ABSTRACT: The base class role for MouseX::POE |
|
6
|
|
|
|
|
|
|
|
|
7
|
11
|
|
|
11
|
|
103
|
use Mouse::Role; |
|
|
11
|
|
|
|
|
22
|
|
|
|
11
|
|
|
|
|
151
|
|
|
8
|
11
|
|
|
11
|
|
10372
|
use POE::Session; |
|
|
11
|
|
|
|
|
30
|
|
|
|
11
|
|
|
|
|
142
|
|
|
9
|
11
|
|
|
11
|
|
1851
|
use Mouse::Util; |
|
|
11
|
|
|
|
|
29
|
|
|
|
11
|
|
|
|
|
113
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub BUILD { |
|
12
|
47
|
|
|
47
|
0
|
23321
|
my $self = shift; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $session = POE::Session->create( |
|
15
|
|
|
|
|
|
|
inline_states => |
|
16
|
47
|
|
|
47
|
|
12585
|
{ _start => sub { POE::Kernel->yield('STARTALL', \$_[5] ) }, }, |
|
17
|
47
|
|
50
|
|
|
358
|
object_states => [ |
|
18
|
|
|
|
|
|
|
$self => { |
|
19
|
|
|
|
|
|
|
$self->meta->get_all_events, |
|
20
|
|
|
|
|
|
|
STARTALL => 'STARTALL', |
|
21
|
|
|
|
|
|
|
_stop => 'STOPALL', |
|
22
|
|
|
|
|
|
|
_child => 'CHILD', |
|
23
|
|
|
|
|
|
|
_parent => 'PARENT', |
|
24
|
|
|
|
|
|
|
_call_kernel_with_my_session => '_call_kernel_with_my_session', |
|
25
|
|
|
|
|
|
|
}, |
|
26
|
|
|
|
|
|
|
], |
|
27
|
|
|
|
|
|
|
args => [$self], |
|
28
|
|
|
|
|
|
|
heap => ( $self->{heap} ||= {} ), |
|
29
|
|
|
|
|
|
|
); |
|
30
|
47
|
|
|
|
|
21504
|
$self->{session_id} = $session->ID; |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub get_session_id { |
|
34
|
83
|
|
|
83
|
1
|
115
|
my ($self) = @_; |
|
35
|
83
|
|
|
|
|
1252
|
return $self->{session_id}; |
|
36
|
|
|
|
|
|
|
#return $self->meta->get_meta_instance->get_session_id($self); |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
80
|
|
|
80
|
1
|
54871
|
sub yield { my $self = shift; POE::Kernel->post( $self->get_session_id, @_ ) } |
|
|
80
|
|
|
|
|
231
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
3
|
|
|
3
|
1
|
6
|
sub call { my $self = shift; POE::Kernel->call( $self->get_session_id, @_ ) } |
|
|
3
|
|
|
|
|
29
|
|
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub _call_kernel_with_my_session { |
|
44
|
3
|
|
|
3
|
|
180
|
my ( $self, $function, @args ) = @_[ OBJECT, ARG0..$#_ ]; |
|
45
|
3
|
|
|
|
|
18
|
POE::Kernel->$function( @args ); |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
3
|
|
|
3
|
1
|
1000802
|
sub delay { my $self = shift; $self->call( _call_kernel_with_my_session => 'delay' => @_ ) } |
|
|
3
|
|
|
|
|
18
|
|
|
49
|
0
|
|
|
0
|
1
|
0
|
sub alarm { my $self = shift; $self->call( _call_kernel_with_my_session => 'alarm', @_ ) } |
|
|
0
|
|
|
|
|
0
|
|
|
50
|
0
|
|
|
0
|
1
|
0
|
sub alarm_add { my $self = shift; $self->call( _call_kernel_with_my_session => 'alarm_add', @_ ) } |
|
|
0
|
|
|
|
|
0
|
|
|
51
|
0
|
|
|
0
|
1
|
0
|
sub delay_add { my $self = shift; $self->call( _call_kernel_with_my_session => 'delay_add', @_ ) } |
|
|
0
|
|
|
|
|
0
|
|
|
52
|
0
|
|
|
0
|
1
|
0
|
sub alarm_set { my $self = shift; $self->call( _call_kernel_with_my_session => 'alarm_set', @_ ) } |
|
|
0
|
|
|
|
|
0
|
|
|
53
|
0
|
|
|
0
|
1
|
0
|
sub alarm_adjust { my $self = shift; $self->call( _call_kernel_with_my_session => 'alarm_adjust', @_ ) } |
|
|
0
|
|
|
|
|
0
|
|
|
54
|
0
|
|
|
0
|
1
|
0
|
sub alarm_remove { my $self = shift; $self->call( _call_kernel_with_my_session => 'alarm_remove', @_ ) } |
|
|
0
|
|
|
|
|
0
|
|
|
55
|
0
|
|
|
0
|
1
|
0
|
sub alarm_remove_all { my $self = shift; $self->call( _call_kernel_with_my_session => 'alarm_remove_all', @_ ) } |
|
|
0
|
|
|
|
|
0
|
|
|
56
|
0
|
|
|
0
|
1
|
0
|
sub delay_set { my $self = shift; $self->call( _call_kernel_with_my_session => 'delay_set', @_ ) } |
|
|
0
|
|
|
|
|
0
|
|
|
57
|
0
|
|
|
0
|
1
|
0
|
sub delay_adjust { my $self = shift; $self->call( _call_kernel_with_my_session => 'delay_adjust', @_ ) } |
|
|
0
|
|
|
|
|
0
|
|
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub STARTALL { |
|
60
|
47
|
|
|
47
|
1
|
17335
|
my ( $self, @params ) = @_; |
|
61
|
47
|
|
|
|
|
92
|
$params[4] = pop @params; |
|
62
|
47
|
|
|
|
|
173
|
for my $class (reverse $self->meta->linearized_isa) { |
|
63
|
145
|
|
100
|
|
|
4140
|
my $start = Mouse::Util::get_code_ref($class, 'START') |
|
64
|
|
|
|
|
|
|
|| next; |
|
65
|
97
|
|
|
|
|
279
|
$start->( $self, @params ); |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub STOPALL { |
|
70
|
76
|
|
|
76
|
1
|
1091053
|
my ( $self, $params ) = @_; |
|
71
|
76
|
|
|
|
|
309
|
for my $class (reverse $self->meta->linearized_isa) { |
|
72
|
232
|
|
100
|
|
|
1927
|
my $start = Mouse::Util::get_code_ref($class, 'STOP') |
|
73
|
|
|
|
|
|
|
|| next; |
|
74
|
145
|
|
|
|
|
305
|
$start->( $self, $params ); |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
47
|
|
|
47
|
1
|
93
|
sub START { } |
|
79
|
76
|
|
|
76
|
1
|
132
|
sub STOP { } |
|
80
|
2
|
|
|
2
|
1
|
167
|
sub CHILD { } |
|
81
|
0
|
|
|
0
|
1
|
|
sub PARENT { } |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# __PACKAGE__->meta->add_method( _stop => sub { POE::Kernel->call('STOP') } ); |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
|
86
|
11
|
|
|
11
|
|
10373
|
no Mouse::Role; |
|
|
11
|
|
|
|
|
27
|
|
|
|
11
|
|
|
|
|
69
|
|
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=pod |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 NAME |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
MouseX::POE::Meta::Trait::Object - The base class role for MouseX::POE |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 VERSION |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
version 0.214 |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
package Counter; |
|
105
|
|
|
|
|
|
|
use MouseX::Poe; |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
has name => ( |
|
108
|
|
|
|
|
|
|
isa => 'Str', |
|
109
|
|
|
|
|
|
|
is => 'rw', |
|
110
|
|
|
|
|
|
|
default => sub { 'Foo ' }, |
|
111
|
|
|
|
|
|
|
); |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
has count => ( |
|
114
|
|
|
|
|
|
|
isa => 'Int', |
|
115
|
|
|
|
|
|
|
is => 'rw', |
|
116
|
|
|
|
|
|
|
lazy => 1, |
|
117
|
|
|
|
|
|
|
default => sub { 0 }, |
|
118
|
|
|
|
|
|
|
); |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub START { |
|
121
|
|
|
|
|
|
|
my ($self) = @_; |
|
122
|
|
|
|
|
|
|
$self->yield('increment'); |
|
123
|
|
|
|
|
|
|
} |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub increment { |
|
126
|
|
|
|
|
|
|
my ($self) = @_; |
|
127
|
|
|
|
|
|
|
$self->count( $self->count + 1 ); |
|
128
|
|
|
|
|
|
|
$self->yield('increment') unless $self->count > 3; |
|
129
|
|
|
|
|
|
|
} |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
no MouseX::Poe; |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
MouseX::POE::Meta::TraitObject is a role that is applied to the object base |
|
136
|
|
|
|
|
|
|
classe (usually Mouse::Object) that implements a POE::Session. |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 METHODS |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head2 get_session_id |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Get the internal POE Session ID, this is useful to hand to other POE aware |
|
143
|
|
|
|
|
|
|
functions. |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head2 yield |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head2 call |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head2 delay |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head2 alarm |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head2 alarm_add |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head2 delay_add |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head2 alarm_set |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head2 alarm_adjust |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head2 alarm_remove |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head2 alarm_remove_all |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head2 delay_set |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head2 delay_adjust |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
A cheap alias for the same POE::Kernel function which will gurantee posting to the object's session. |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head2 STARTALL |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Along similar lines to Mouse's C method which calls all the C |
|
174
|
|
|
|
|
|
|
methods, this function will call all the C methods in your inheritance |
|
175
|
|
|
|
|
|
|
hierarchy automatically when POE first runs your session. (This corresponds to |
|
176
|
|
|
|
|
|
|
the C<_start> event from POE.) |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head2 STOPALL |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
Along similar lines to C, but for C instead. |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head2 START |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head2 STOP |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=head2 DEFAULT |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head2 CHILD |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head2 PARENT |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=begin comment |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=end comment |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
__PACKAGE__->meta->add_method( |
|
200
|
|
|
|
|
|
|
_default => __PACKAGE__->meta->get_method('DEFAULT') ) |
|
201
|
|
|
|
|
|
|
if __PACKAGE__->meta->has_method('DEFAULT'); |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
__PACKAGE__->meta->add_method( |
|
204
|
|
|
|
|
|
|
_child => __PACKAGE__->meta->get_method('CHILD') ) |
|
205
|
|
|
|
|
|
|
if __PACKAGE__->meta->has_method('CHILD'); |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
__PACKAGE__->meta->add_method( |
|
208
|
|
|
|
|
|
|
_parent => __PACKAGE__->meta->get_method('PARENT') ) |
|
209
|
|
|
|
|
|
|
if __PACKAGE__->meta->has_method('PARENT'); |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=for Pod::Coverage BUILD |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=head1 DEFAULT METHODS |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=head1 PREDEFINED EVENTS |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=head1 AUTHORS |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=over 4 |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=item * |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
Chris Prather |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=item * |
|
226
|
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
Ash Berlin |
|
228
|
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=item * |
|
230
|
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
Chris Williams |
|
232
|
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=item * |
|
234
|
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
Yuval (nothingmuch) Kogman |
|
236
|
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=item * |
|
238
|
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
Torsten Raudssus L |
|
240
|
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=back |
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
This software is copyright (c) 2010 by Chris Prather, Ash Berlin, Chris Williams, Yuval Kogman, Torsten Raudssus. |
|
246
|
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
248
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=cut |
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
__END__ |