line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::Engine::Role::Interface; |
2
|
28
|
|
|
28
|
|
18289
|
use Any::Moose '::Role'; |
|
28
|
|
|
|
|
63
|
|
|
28
|
|
|
|
|
184
|
|
3
|
28
|
|
|
28
|
|
11867
|
use HTTP::Engine::Types::Core qw(Handler); |
|
28
|
|
|
|
|
63
|
|
|
28
|
|
|
|
|
248
|
|
4
|
28
|
|
|
28
|
|
18299
|
use HTTP::Engine::ResponseFinalizer; |
|
28
|
|
|
|
|
73
|
|
|
28
|
|
|
|
|
7457
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
requires 'run'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
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
|
|
|
1
|
0
|
26
|
sub can_has_streaming { 0 } |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub handle_request { |
20
|
39
|
|
|
39
|
0
|
4381
|
my ($self, %args) = @_; |
21
|
|
|
|
|
|
|
|
22
|
39
|
|
|
|
|
215
|
my $req = HTTP::Engine::Request->new( |
23
|
|
|
|
|
|
|
request_builder => $self->request_builder, |
24
|
|
|
|
|
|
|
%args, |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
39
|
|
|
|
|
193
|
my $res; |
28
|
39
|
|
|
|
|
87
|
eval { |
29
|
39
|
|
|
|
|
238
|
$res = $self->request_handler->($req); |
30
|
38
|
100
|
100
|
|
|
1581
|
unless ( Scalar::Util::blessed($res) |
31
|
|
|
|
|
|
|
&& $res->isa('HTTP::Engine::Response') ) |
32
|
|
|
|
|
|
|
{ |
33
|
9
|
|
|
|
|
89
|
die "You should return instance of HTTP::Engine::Response."; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
}; |
36
|
39
|
100
|
|
|
|
182
|
if ( my $e = $@ ) { |
37
|
10
|
|
|
|
|
47
|
print STDERR $e; |
38
|
10
|
|
|
|
|
303
|
$res = HTTP::Engine::Response->new( |
39
|
|
|
|
|
|
|
status => 500, |
40
|
|
|
|
|
|
|
body => 'internal server error', |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
39
|
|
|
|
|
356
|
HTTP::Engine::ResponseFinalizer->finalize( $req => $res => $self ); |
45
|
|
|
|
|
|
|
|
46
|
37
|
|
|
|
|
186
|
return $self->response_writer->finalize( $req => $res ); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |