line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MouseX::POE::Meta::Trait; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
11
|
|
|
11
|
|
9043
|
$MouseX::POE::Meta::Trait::VERSION = '0.214'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
# ABSTRACT: There be dragons here. |
6
|
11
|
|
|
11
|
|
83
|
use Mouse::Role; |
|
11
|
|
|
|
|
22
|
|
|
11
|
|
|
|
|
73
|
|
7
|
|
|
|
|
|
|
|
8
|
11
|
|
|
11
|
|
11329
|
use MouseX::POE::Meta::Method::State; |
|
11
|
|
|
|
|
66
|
|
|
11
|
|
|
|
|
2526
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has events => ( |
11
|
|
|
|
|
|
|
reader => 'get_events', |
12
|
|
|
|
|
|
|
traits => ['Array'], |
13
|
|
|
|
|
|
|
isa => 'ArrayRef', |
14
|
|
|
|
|
|
|
auto_deref => 1, |
15
|
|
|
|
|
|
|
lazy_build => 1, |
16
|
|
|
|
|
|
|
builder => 'default_events', |
17
|
|
|
|
|
|
|
handles => { 'add_event' => ['push'] }, |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub default_events { |
21
|
13
|
|
|
13
|
0
|
45
|
return []; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub get_state_method_name { |
25
|
107
|
|
|
107
|
0
|
174
|
my ( $self, $name ) = @_; |
26
|
107
|
50
|
|
|
|
254
|
return $name if $self->has_method($name); |
27
|
0
|
|
|
|
|
0
|
return undef; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub add_state_method { |
31
|
11
|
|
|
11
|
0
|
25
|
my ( $self, $name, $method ) = @_; |
32
|
11
|
50
|
|
|
|
74
|
if ( $self->has_method($name) ) { |
33
|
0
|
|
|
|
|
0
|
my $full_name = $self->get_method($name)->fully_qualified_name; |
34
|
0
|
|
|
|
|
0
|
confess "Cannot add a state method ($name) if a local method ($full_name) is already present"; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
11
|
|
|
|
|
357
|
$self->add_event($name); |
38
|
11
|
|
|
|
|
213
|
$self->add_method( $name => $method ); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__END__ |