POE/Meta/Trait.pm

filter: Statementstmt 83.3% 20 / 24 Branchbran 50.0% 3 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 3 totaltotal 74.3% 29 / 39 CC 4 SCAR 6.0
CC
4
Cov
77%
get_state_method_name
2.3
__ANON__
2.3
add_state_method
2.2
CRAP 1.8
« POE/Meta/Trait/Instance.pm ↑ Summary POE/Meta/Trait/Object.pm »
1 package MooseX::POE::Meta::Trait;
2 {
3 16 $MooseX::POE::Meta::Trait::VERSION = '0.215';
4 }
5 # ABSTRACT: There be dragons here.
6 16 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 16 ▶use MooseX::POE::Meta::Method::State;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 16 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 25 ▶sub default_events {
Subroutine default_events: called CC=1 SCAR=0.0
Pod undocumented
21 25 return [];
22 }
23  
24 110 ▶sub get_state_method_name {
Subroutine get_state_method_name: called CC=2 SCAR=8.1
Pod undocumented
25 110 my ( $self, $name ) = @_;
26 110 ▶ return $name if $self->has_method($name);
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_method($name) 110 0 110
27 0 return undef;
28 }
29  
30 24 ▶sub add_state_method {
Subroutine add_state_method: called CC=2 SCAR=7.9
Pod undocumented
31 24 my ( $self, $name, $method ) = @_;
32 24 ▶ if ( $self->has_method($name) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_method($name)) 0 24 24
33 0 my $full_name = $self->get_method($name)->fully_qualified_name;
34 0 confess "Cannot add a state method ($name) if a local method ($full_name) is already present";
35 }
36  
37 24 $self->add_event($name);
38 24 $self->add_method( $name => $method );
39 }
40  
41 6 ▶after add_role => sub {
Subroutine __ANON__: called CC=2 SCAR=8.1
42 6 my ( $self, $role ) = @_;
43  
44 6 ▶ if ( $role->isa("MooseX::POE::Meta::Role") ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($role->isa("MooseX::POE::Meta::Role")) 0 6 6
45 0 $self->add_event( $role->get_events );
46 }
47 16 };
48  
49 16 1;
50  
51 __END__
« POE/Meta/Trait/Instance.pm ↑ Summary POE/Meta/Trait/Object.pm »