Engine/Role/Interface.pm

filter: Statementstmt 100% 25 / 25 Branchbran 100% 4 / 4 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 2 totaltotal 95.1% 39 / 41 CC 4 SCAR 9.2
CC
4
Cov
100%
handle_request
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.5
« Engine/MinimalCGI.pm ↑ Summary Engine/Role/RequestBuilder/Standard.pm »
1 package HTTP::Engine::Role::Interface;
2 28 ▶use Any::Moose '::Role';
Subroutine BEGIN: called CC=1 SCAR=0.0
3 28 ▶use HTTP::Engine::Types::Core qw(Handler);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 28 ▶use HTTP::Engine::ResponseFinalizer;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 28 requires 'run';
7  
8 28 has request_handler => (
9 is => 'rw',
10 isa => Handler,
11 coerce => 1,
12 required => 1,
13 );
14  
15 # for PSGI streaming response
16 # using HTTP::Engine::ResponseFinalizer
17 1 ▶sub can_has_streaming { 0 }
Subroutine can_has_streaming: called CC=1 SCAR=0.0
Pod undocumented
18  
19 39 ▶sub handle_request {
Subroutine handle_request: called CC=4 SCAR=13.9
Pod undocumented
20 39 my ($self, %args) = @_;
21  
22 39 my $req = HTTP::Engine::Request->new(
23 request_builder => $self->request_builder,
24 %args,
25 );
26  
27 39 my $res;
28 39 eval {
29 39 $res = $self->request_handler->($req);
30 38 ▶ unless ( Scalar::Util::blessed($res)
Branch: 1 branch
BranchTrueFalseTotal
unless (builtin::blessed($res) and $res->isa("HTTP::Engine::Response")) 9 29 38
Condition100%3/3
builtin::blessed($res) and $res->isa("HTTP::Engine::Response")
!ll&&!rl&&r
8129
MC/DC100%2/2
builtin::blessed($res) and $res->isa("HTTP::Engine::Response")
builtin::blessed($res) $res->isa("HTTP::Engine::Response")
Truth table100%3/3
A and B
A= builtin::blessed($res)B= $res->isa("HTTP::Engine::Response")
ABresult
0X0
100
111
31 && $res->isa('HTTP::Engine::Response') )
32 {
33 9 die "You should return instance of HTTP::Engine::Response.";
34 }
35 };
36 39 ▶ if ( my $e = $@ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $e = $@) 10 29 39
37 10 print STDERR $e;
38 10 $res = HTTP::Engine::Response->new(
39 status => 500,
40 body => 'internal server error',
41 );
42 }
43  
44 39 HTTP::Engine::ResponseFinalizer->finalize( $req => $res => $self );
45  
46 37 return $self->response_writer->finalize( $req => $res );
47 }
48  
49 28 1;
50  
51 __END__
« Engine/MinimalCGI.pm ↑ Summary Engine/Role/RequestBuilder/Standard.pm »