OX/Application/Role/Router/Path/Router.pm

filter: Statementstmt 100% 26 / 26 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 10 / 10 Podpod 0.0% 0 / 2 totaltotal 84.4% 38 / 45 CC 3 SCAR 4.3
CC
3
Cov
90%
__ANON__
3.1
app_from_router
1.0
BEGIN
1.0
CRAP 1.5
« OX/Meta/Role/HasRouteBuilders.pm ↑ Summary OX/Application.pm »
1 package OX::Application::Role::Router::Path::Router;
2 44 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 44 $OX::Application::Role::Router::Path::Router::AUTHORITY = 'cpan:STEVAN';
4 }
5 44 $OX::Application::Role::Router::Path::Router::VERSION = '0.14';
6 44 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 44 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 # ABSTRACT: implementation of OX::Application::Role::Router which uses Path::Router
9  
10 44 ▶use Plack::App::Path::Router::Custom 0.05;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 44 with 'OX::Application::Role::Router', 'OX::Application::Role::Request';
13  
14  
15 285 ▶sub router_class { 'Path::Router' }
Subroutine router_class: called CC=1 SCAR=0.0
Pod undocumented
16  
17 94 ▶sub app_from_router {
Subroutine app_from_router: called CC=1 SCAR=0.1
Pod undocumented
18 94 my $self = shift;
19 94 my ($router) = @_;
20  
21 return Plack::App::Path::Router::Custom->new(
22 router => $router,
23 207 ▶ new_request => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
24 207 $self->new_request(@_);
25 },
26 183 ▶ target_to_app => sub {
Subroutine __ANON__: called CC=3 SCAR=11.4
27 183 my ($target) = @_;
28 183 ▶ my $app = blessed($target) && $target->can('to_app')
Branch: 1 branch
BranchTrueFalseTotal
builtin::blessed($target) && $target->can('to_app') ? : 0 183 183
Condition33%1/3
builtin::blessed($target) and $target->can("to_app")
!ll&&!rl&&r
18300
MC/DC0%0/2
builtin::blessed($target) and $target->can("to_app")
builtin::blessed($target) $target->can("to_app")
Truth table33%1/3
A and B
A= builtin::blessed($target)B= $target->can("to_app")
ABresult
0X0
100
111
29 ? $target->to_app
30 : $target;
31 183 ▶ sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
32 183 my ($req, @args) = @_;
33 183 @args = map { $req->_decode($_) } @args;
34 183 $app->($req, @args);
35 }
36 183 },
37 203 ▶ handle_response => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
38 203 $self->handle_response(@_);
39 },
40 94 )->to_app;
41 }
42  
43  
44 44 1;
45  
46 __END__
« OX/Meta/Role/HasRouteBuilders.pm ↑ Summary OX/Application.pm »