Async/Meta/Trait.pm

filter: Statementstmt 48.0% 12 / 25 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 42.8% 3 / 7 Podpod 0.0% 0 / 3 totaltotal 36.5% 15 / 41 CC 4 SCAR 14.1
CC
4
Cov
39%
get_state_method_name
6.0
add_state_method
6.0
__ANON__
6.0
CRAP 4.1
↑ Summary ._Async.pm »
1 package MooseX::Async::Meta::Trait;
2 1 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 1 ▶use MooseX::Async::Meta::Method::State;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use MooseX::AttributeHelpers;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 has events => (
8 reader => 'get_events',
9 metaclass => 'Collection::Array',
10 isa => 'ArrayRef',
11 auto_deref => 1,
12 lazy_build => 1,
13 builder => 'default_events',
14 provides => { push => 'add_event', }
15 );
16  
17 0 ▶sub default_events {
Subroutine default_events: not called CC=1 SCAR=6.9
Pod undocumented
18 0 return [];
19 }
20  
21 0 ▶sub get_state_method_name {
Subroutine get_state_method_name: not called CC=2 SCAR=17.9
Pod undocumented
22 0 my ( $self, $name ) = @_;
23 0 ▶ return $name if $self->has_method($name);
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_method($name) 0 0 0
24 0 return undef;
25 }
26  
27 0 ▶sub add_state_method {
Subroutine add_state_method: not called CC=2 SCAR=17.9
Pod undocumented
28 0 my ( $self, $name, $method ) = @_;
29 0 ▶ if ( $self->has_method($name) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_method($name)) 0 0 0
30 0 my $full_name = $self->get_method($name)->fully_qualified_name;
31 0 confess
32 "Cannot add a state method ($name) if a local method ($full_name) is already present";
33 }
34  
35 0 $self->add_event($name);
36 0 $self->add_method( $name => $method );
37 }
38  
39 0 ▶after add_role => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
40 0 my ( $self, $role ) = @_;
41  
42 0 ▶ if ( $role->isa("MooseX::Async::Meta::Role") ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($role->isa("MooseX::Async::Meta::Role")) 0 0 0
43 0 $self->add_event($role->get_events);
44 }
45 1 };
46  
47 1 1;
↑ Summary ._Async.pm »