| 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
Condition66%2/3
builtin::blessed($target) and $target->can("execute")
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")
| |||||||||||||||||||||||||||||||||
| 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
Condition33%1/3
builtin::blessed($res) and $res->can("finalize")
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")
| |||||||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||||||