Router.pm

filter: Statementstmt 97.3% 36 / 37 Branchbran 83.3% 5 / 6 Conditioncond 50.0% 3 / 6 MC/DCmcdc 25.0% 1 / 4 Subroutinesub 100% 13 / 13 Podpod n/a totaltotal 87.8% 58 / 66 CC 6 SCAR 7.6
CC
6
Cov
90%
__ANON__
4.6
__ANON__
3.0
__ANON__
1.0
CRAP 2.1
↑ Summary Router/Custom.pm »
1 package Plack::App::Path::Router;
2 8 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 8 $Plack::App::Path::Router::AUTHORITY = 'cpan:STEVAN';
4 }
5 8 $Plack::App::Path::Router::VERSION = '0.08';
6 8 ▶use Moose 0.90;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 8 ▶use MooseX::NonMoose 0.07;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 # ABSTRACT: A Plack component for dispatching with Path::Router
9  
10 8 ▶use Plack::Request 0.08;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 8 extends 'Plack::App::Path::Router::Custom';
13  
14  
15  
16  
17 has 'request_class' => (
18 is => 'ro',
19 isa => 'ClassName',
20 6 ▶ default => sub { 'Plack::Request' },
Subroutine __ANON__: called CC=1 SCAR=0.0
21 8 );
22  
23 has '+new_request' => (
24 7 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
25 7 my $self = shift;
26 33 ▶ sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
27 33 $self->request_class->new(@_);
28 7 };
29 },
30 8 );
31  
32 has '+target_to_app' => (
33 7 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
34 27 ▶ sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
35 27 my ($target) = @_;
36  
37 27 ▶ if (blessed $target && $target->can('execute')) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($target) and $target->can('execute')) { } 2 25 27
Condition66%2/3
builtin::blessed($target) and $target->can("execute")
!ll&&!rl&&r
2502
MC/DC50%1/2
builtin::blessed($target) and $target->can("execute")
builtin::blessed($target) $target->can("execute")
Truth table66%2/3
A and B
A= builtin::blessed($target)B= $target->can("execute")
ABresult
0X0
100
111
38 2 ▶ return sub { $target->execute(@_) };
Subroutine __ANON__: called CC=1 SCAR=0.0
39 }
40 else {
41 25 return $target;
42 }
43 7 };
44 },
45 8 );
46  
47 has '+handle_response' => (
48 7 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.3
49 33 ▶ sub {
Subroutine __ANON__: called CC=4 SCAR=15.2
50 33 my ($res) = @_;
51  
52 33 ▶ if ( blessed $res && $res->can('finalize') ) {
Branch: 2 branches
BranchTrueFalseTotal
if (builtin::blessed($res) and $res->can('finalize')) { } 0 33 33
elsif (not ref $res) { } 22 11 33
Condition33%1/3
builtin::blessed($res) and $res->can("finalize")
!ll&&!rl&&r
3300
MC/DC0%0/2
builtin::blessed($res) and $res->can("finalize")
builtin::blessed($res) $res->can("finalize")
Truth table33%1/3
A and B
A= builtin::blessed($res)B= $res->can("finalize")
ABresult
0X0
100
111
53 0 return $res->finalize;
54 }
55 elsif ( not ref $res ) {
56 22 return [ 200, [ 'Content-Type' => 'text/html' ], [ $res ] ];
57 }
58 else {
59 11 return $res;
60 }
61 7 };
62 },
63 8 );
64  
65 8 __PACKAGE__->meta->make_immutable;
66 8 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
67  
68 8 1;
69  
70 __END__
↑ Summary Router/Custom.pm »