| 1 | package MouseX::POE::Meta::Trait; | ||||||||||
| 2 | 16 | $MouseX::POE::Meta::Trait::VERSION = '0.216'; | |||||||||
| 3 | # ABSTRACT: There be dragons here. | ||||||||||
| 4 | 16 | ▶ | use Mouse::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 16 | ▶ | use MouseX::POE::Meta::Method::State; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 16 | has events => ( | |||||||||
| 9 | reader => 'get_events', | ||||||||||
| 10 | traits => ['Array'], | ||||||||||
| 11 | isa => 'ArrayRef', | ||||||||||
| 12 | auto_deref => 1, | ||||||||||
| 13 | lazy_build => 1, | ||||||||||
| 14 | builder => 'default_events', | ||||||||||
| 15 | handles => { 'add_event' => ['push'] }, | ||||||||||
| 16 | ); | ||||||||||
| 17 | |||||||||||
| 18 | 13 | ▶ | sub default_events { | ||||||||
|
Subroutine
default_events: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 19 | 13 | return []; | |||||||||
| 20 | } | ||||||||||
| 21 | |||||||||||
| 22 | 98 | ▶ | sub get_state_method_name { | ||||||||
|
Subroutine
get_state_method_name: called CC=2 SCAR=8.1
Pod
undocumented
| |||||||||||
| 23 | 98 | my ( $self, $name ) = @_; | |||||||||
| 24 | 98 | ▶ | return $name if $self->has_method($name); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | 0 | return undef; | |||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | 11 | ▶ | sub add_state_method { | ||||||||
|
Subroutine
add_state_method: called CC=2 SCAR=7.9
Pod
undocumented
| |||||||||||
| 29 | 11 | my ( $self, $name, $method ) = @_; | |||||||||
| 30 | 11 | ▶ | if ( $self->has_method($name) ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | 0 | my $full_name = $self->get_method($name)->fully_qualified_name; | |||||||||
| 32 | 0 | confess "Cannot add a state method ($name) if a local method ($full_name) is already present"; | |||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | 11 | $self->add_event($name); | |||||||||
| 36 | 11 | $self->add_method( $name => $method ); | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 16 | 1; | |||||||||
| 40 | |||||||||||
| 41 | __END__ | ||||||||||