lib/Catalyst/ActionContainer.pm

filter: Statementstmt 100% 26 / 26 Branchbran 100% 4 / 4 Conditioncond 50.0% 3 / 6 MC/DCmcdc 25.0% 1 / 4 Subroutinesub 100% 8 / 8 Podpod 100% 2 / 2 totaltotal 88.0% 44 / 50 CC 5 SCAR 6.2
CC
5
Cov
92%
__ANON__
3.0
add_action
2.1
get_action
2.0
CRAP 1.9
« lib/Catalyst/Script/Create.pm ↑ Summary lib/Catalyst/Script/FastCGI.pm »
1 package Catalyst::ActionContainer;
2  
3 =head1 NAME
4  
5 Catalyst::ActionContainer - Catalyst Action Container
6  
7 =head1 SYNOPSIS
8  
9 See L<Catalyst>.
10  
11 =head1 DESCRIPTION
12  
13 This is a container for actions. The dispatcher sets up a tree of these
14 to represent the various dispatch points in your application.
15  
16 =cut
17  
18 154 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 154 with 'MooseX::Emulate::Class::Accessor::Fast';
20  
21 154 has part => (is => 'rw', required => 1);
22 5915 ▶has actions => (is => 'rw', required => 1, lazy => 1, default => sub { {} });
Subroutine __ANON__: called CC=1 SCAR=0.0
23  
24 6322 ▶around BUILDARGS => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
25 6322 my ($next, $self, @args) = @_;
26 6322 ▶ unshift @args, 'part' if scalar @args == 1 && !ref $args[0];
Branch: 1 branch
BranchTrueFalseTotal
if scalar @args == 1 and not ref $args[0] 6159 163 6322
Condition66%2/3
scalar @args == 1 and not ref $args[0]
!ll&&!rl&&r
01636159
MC/DC50%1/2
scalar @args == 1 and not ref $args[0]
scalar @args == 1 not ref $args[0]
Truth table66%2/3
A and not(B)
A= scalar @args == 1B= not ref $args[0]
ABresult
0X0
100
111
27 6322 return $self->$next(@args);
28 154 };
29  
30 154 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
31  
32 154 ▶use overload (
Subroutine BEGIN: called CC=1 SCAR=0.0
33 # Stringify to path part for tree search
34 22 ▶ q{""} => sub { shift->part },
Subroutine __ANON__: called CC=1 SCAR=0.0
35 154 );
36  
37 6229 ▶sub get_action {
Subroutine get_action: called CC=2 SCAR=6.9
Pod documented
38 6229 my ( $self, $name ) = @_;
39 6229 ▶ return $self->actions->{$name} if defined $self->actions->{$name};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->actions->{$name} 1535 4694 6229
40 4694 return;
41 }
42  
43 66249 ▶sub add_action {
Subroutine add_action: called CC=2 SCAR=7.6
Pod documented
44 66249 my ( $self, $action, $name ) = @_;
45 66249 ▶ $name ||= $action->name;
Condition33%1/3
$name ||= $action->name
l!l&&r!l&&!r
0662490
MC/DC0%0/2
$name ||= $action->name
$name $action->name
Truth table33%1/3
A ||= B
A= $nameB= $action->name
ABresult
1X1
011
000
46 66249 $self->actions->{$name} = $action;
47 }
48  
49 154 __PACKAGE__->meta->make_immutable;
50  
51 154 1;
52  
53 __END__
« lib/Catalyst/Script/Create.pm ↑ Summary lib/Catalyst/Script/FastCGI.pm »