OX/Application/Role/RouterConfig.pm

filter: Statementstmt 100% 20 / 20 Branchbran 75.0% 3 / 4 Conditioncond 66.6% 4 / 6 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 86.4% 32 / 37 CC 5 SCAR 12.7
CC
5
Cov
90%
__ANON__
5.1
BEGIN
1.0
BEGIN
1.0
CRAP 3.6
« OX.pm ↑ Summary OX/RouteBuilder/HTTPMethod.pm »
1 package OX::Application::Role::RouterConfig;
2 2 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 $OX::Application::Role::RouterConfig::AUTHORITY = 'cpan:STEVAN';
4 }
5 2 $OX::Application::Role::RouterConfig::VERSION = '0.14';
6 2 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 # ABSTRACT: adds some common shortcuts to route declarations from OX::Application::Role::RouteBuilder
9  
10 2 with 'OX::Application::Role::RouteBuilder';
11  
12  
13 4 ▶around parse_route => sub {
Subroutine __ANON__: called CC=5 SCAR=16.3
14 4 my $orig = shift;
15 4 my $self = shift;
16 4 my ($path, $route) = @_;
17  
18 4 ▶ if (ref($route) eq 'HASH'
Branch: 2 branches
BranchTrueFalseTotal
if (ref $route eq 'HASH' and exists $route->{'controller'} and exists $route->{'action'}) { } 2 2 4
elsif (ref $route eq 'CODE') { } 2 0 2
Condition66%4/6
ref $route eq "HASH" and exists $route->{"controller"} and exists $route->{"action"}
!ll&&!rl&&r
202
ref $route eq "HASH" and exists $route->{"controller"}
!ll&&!rl&&r
202
MC/DC33%1/3
ref $route eq "HASH" and exists $route->{"controller"} and exists $route->{"action"}
ref $route eq "HASH" exists $route->{"controller"} exists $route->{"action"}
Truth table50%2/4
A and B and C
A= ref $route eq "HASH"B= exists $route->{"controller"}C= exists $route->{"action"}
ABCresult
0XX0
10X0
1100
1111
19 && exists($route->{controller})
20 && exists($route->{action})) {
21 2 my $controller = delete $route->{controller};
22 2 my $action = delete $route->{action};
23  
24 2 $route = {
25 class => 'OX::RouteBuilder::ControllerAction',
26 route_spec => {
27 controller => $controller,
28 action => $action,
29 },
30 params => $route,
31 };
32 }
33 elsif (ref($route) eq 'CODE') {
34 2 $route = {
35 class => 'OX::RouteBuilder::Code',
36 route_spec => $route,
37 params => {},
38 };
39 }
40  
41 4 return $self->$orig($path, $route);
42 2 };
43  
44 2 1;
45  
46 __END__
« OX.pm ↑ Summary OX/RouteBuilder/HTTPMethod.pm »