POE/Meta/Trait.pm

filter: Statementstmt 84.2% 16 / 19 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 3 totaltotal 74.1% 23 / 31 CC 3 SCAR 5.3
CC
3
Cov
78%
get_state_method_name
2.3
add_state_method
2.2
BEGIN
1.0
CRAP 1.7
« POE/Meta/Trait/Object.pm ↑ Summary POE/Meta/Trait/Class.pm »
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
BranchTrueFalseTotal
if $self->has_method($name) 98 0 98
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
BranchTrueFalseTotal
if ($self->has_method($name)) 0 11 11
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__
« POE/Meta/Trait/Object.pm ↑ Summary POE/Meta/Trait/Class.pm »