| 1 | package OX::Application::Role::Request; | ||||||||||||||||||||
| 2 | 45 | ▶ | BEGIN { | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 45 | $OX::Application::Role::Request::AUTHORITY = 'cpan:STEVAN'; | |||||||||||||||||||
| 4 | } | ||||||||||||||||||||
| 5 | 45 | $OX::Application::Role::Request::VERSION = '0.14'; | |||||||||||||||||||
| 6 | 45 | ▶ | use Moose::Role; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 45 | ▶ | use namespace::autoclean; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | # ABSTRACT: application role to allow the use of request and response objects | ||||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | 45 | ▶ | use Class::Load 'load_class'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 0 | ▶ | sub BUILD { } | ||||||||||||||||||
|
Subroutine
BUILD: not called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 14 | 97 | ▶ | before BUILD => sub { | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 15 | 97 | my $self = shift; | |||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | 97 | load_class($self->request_class); | |||||||||||||||||||
| 18 | 45 | }; | |||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | 304 | ▶ | sub request_class { 'OX::Request' } | ||||||||||||||||||
|
Subroutine
request_class: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | 207 | ▶ | sub new_request { | ||||||||||||||||||
|
Subroutine
new_request: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 25 | 207 | my $self = shift; | |||||||||||||||||||
| 26 | 207 | my ($env) = @_; | |||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | 207 | return $self->request_class->new(env => $env); | |||||||||||||||||||
| 29 | } | ||||||||||||||||||||
| 30 | |||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | 203 | ▶ | sub handle_response { | ||||||||||||||||||
|
Subroutine
handle_response: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||
| 33 | 203 | my $self = shift; | |||||||||||||||||||
| 34 | 203 | my ($res, $req) = @_; | |||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | 203 | ▶ | if (!ref($res)) { | ||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||
| 37 | 131 | $res = $req->new_response([ | |||||||||||||||||||
| 38 | 200, [ 'Content-Type' => 'text/html' ], [ $res ] | ||||||||||||||||||||
| 39 | ]); | ||||||||||||||||||||
| 40 | } | ||||||||||||||||||||
| 41 | ▶ | elsif (!blessed($res) || !$res->can('finalize')) { | |||||||||||||||||||
|
Condition66%2/3
builtin::blessed($res) && $res->can('finalize')
MC/DC50%1/2
builtin::blessed($res) && $res->can('finalize')
builtin::blessed($res)
$res->can('finalize')
Truth table66%2/3
A && B
A= builtin::blessed($res)B= $res->can('finalize')
| |||||||||||||||||||||
| 42 | 71 | $res = $req->new_response($res); | |||||||||||||||||||
| 43 | } | ||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | 203 | return $res->finalize; | |||||||||||||||||||
| 46 | } | ||||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | 45 | 1; | |||||||||||||||||||
| 50 | |||||||||||||||||||||
| 51 | __END__ | ||||||||||||||||||||