line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MouseX::POE::Meta::Trait::Class; |
2
|
|
|
|
|
|
|
$MouseX::POE::Meta::Trait::Class::VERSION = '0.216'; |
3
|
|
|
|
|
|
|
# ABSTRACT: No achmed inside |
4
|
11
|
|
|
11
|
|
4122
|
use Mouse::Role; |
|
11
|
|
|
|
|
5709
|
|
|
11
|
|
|
|
|
34
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
with qw(MouseX::POE::Meta::Trait); |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# TODO: subclass events to be a hashref that maps the event to the method |
9
|
|
|
|
|
|
|
# so we can support on_ events |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
around default_events => sub { |
12
|
|
|
|
|
|
|
my ( $next, $self ) = @_; |
13
|
|
|
|
|
|
|
my $events = $next->($self); |
14
|
|
|
|
|
|
|
push @$events, grep { s/^on_(\w+)/$1/; } $self->get_method_list; |
15
|
|
|
|
|
|
|
return $events; |
16
|
|
|
|
|
|
|
}; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
around get_state_method_name => sub { |
20
|
|
|
|
|
|
|
my ( $next, $self, $name ) = @_; |
21
|
|
|
|
|
|
|
return 'on_' . $name if $self->has_method( 'on_' . $name ); |
22
|
|
|
|
|
|
|
return $next->( $self, $name ); |
23
|
|
|
|
|
|
|
}; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub get_all_events { |
26
|
47
|
|
|
47
|
1
|
504
|
my ($self) = @_; |
27
|
47
|
|
|
|
|
64
|
my $wanted_role = 'MouseX::POE::Meta::Trait'; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# This horrible grep can be removed once Mouse gets more metacircular. |
30
|
|
|
|
|
|
|
# Currently Mouse::Meta::Class->meta isn't a MMC. It should be, and it |
31
|
|
|
|
|
|
|
# should also be a Mouse::Object so does works on it. |
32
|
51
|
|
|
|
|
1150
|
my %events |
33
|
|
|
|
|
|
|
= map { |
34
|
145
|
50
|
|
|
|
4283
|
my $m = $_; |
35
|
51
|
|
|
|
|
173
|
map { $_ => $m->get_state_method_name($_) } $m->get_events |
|
122
|
|
|
|
|
695
|
|
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
grep { |
38
|
145
|
|
|
|
|
877
|
$_->meta->can('does_role') && $_->meta->does_role($wanted_role) |
39
|
|
|
|
|
|
|
} |
40
|
47
|
|
|
|
|
216
|
map { $_->meta } $self->linearized_isa; |
41
|
47
|
|
|
|
|
1063
|
return %events; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
11
|
|
|
11
|
|
4289
|
no Mouse::Role; |
|
11
|
|
|
|
|
16
|
|
|
11
|
|
|
|
|
44
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |