blib/lib/Gapp/Action/Registry.pm

filter: Statementstmt 74.0% 20 / 27 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 62.5% 5 / 8 Podpod 100% 2 / 2 totaltotal 65.8% 27 / 41 CC 3 SCAR 11.3
CC
3
Cov
65%
add_action
6.0
perform
6.0
__ANON__
2.0
CRAP 3.1
« blib/lib/Gapp/Action.pm ↑ Summary blib/lib/Gapp/Meta/Widget/Native/Trait/ListFormField.pm »
1 package Gapp::Action::Registry;
2 {
3 1 $Gapp::Action::Registry::VERSION = '0.60';
4 }
5  
6 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use MooseX::SemiAffordanceAccessor;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use MooseX::StrictConstructor;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use MooseX::Types::Moose qw( Object HashRef );
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 has 'actions' => (
13 is => 'bare',
14 isa => HashRef,
15 0 ▶ default => sub { { } },
Subroutine __ANON__: not called CC=1 SCAR=6.9
16 1 traits => [ qw( Hash )],
17 handles => {
18 _set_action => 'set',
19 actions => 'values',
20 action => 'get',
21 action_list => 'keys',
22 has_action => 'exists',
23 }
24 );
25  
26 0 ▶sub add_action {
Subroutine add_action: not called CC=2 SCAR=17.9
Pod documented
27 0 my ( $self, $action ) = @_;
28
29
30 0 ▶ $action = Gapp::Action->new( $action ) if ! is_Object($action);
Branch: 1 branch
BranchTrueFalseTotal
unless is_Object($action) 0 0 0
31 0 $self->_set_action( $action->name, $action );
32 }
33  
34 0 ▶sub perform {
Subroutine perform: not called CC=2 SCAR=17.9
Pod documented
35 0 my ( $self, $action, @args ) = @_;
36
37 0 ▶ $self->meta->throw_error( qq[action ($action) does not exist] )
Branch: 1 branch
BranchTrueFalseTotal
unless $self->has_action($action) 0 0 0
38 if ! $self->has_action( $action );
39
40 0 $self->action( $action )->perform( $self, @args );
41 }
42  
43  
44  
45 1 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
46 1 __PACKAGE__->meta->make_immutable;
47  
48 1 1;
49  
50 __END__
« blib/lib/Gapp/Action.pm ↑ Summary blib/lib/Gapp/Meta/Widget/Native/Trait/ListFormField.pm »