line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojo::Server::AWSLambda; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
280867
|
use Mojo::Base 'Mojo::Server'; |
|
2
|
|
|
|
|
188323
|
|
|
2
|
|
|
|
|
13
|
|
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
92225
|
use Mojo::Server::AWSLambda::Request; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
29
|
|
6
|
2
|
|
|
2
|
|
1121
|
use Mojo::Server::AWSLambda::Response; |
|
2
|
|
|
|
|
21
|
|
|
2
|
|
|
|
|
31
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
78
|
use Mojo::Util qw; |
|
2
|
|
|
|
|
14
|
|
|
2
|
|
|
|
|
98
|
|
9
|
2
|
|
|
2
|
|
12
|
use Scalar::Util 'blessed'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
880
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = "0.01"; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub load_app { |
15
|
0
|
|
|
0
|
1
|
0
|
my ($self, $path) = @_; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
{ |
18
|
0
|
|
|
|
|
0
|
require FindBin; |
|
0
|
|
|
|
|
0
|
|
19
|
0
|
|
|
|
|
0
|
FindBin->again; |
20
|
0
|
|
|
|
|
0
|
local $ENV{MOJO_APP_LOADER} = 1; |
21
|
0
|
|
|
|
|
0
|
local $ENV{MOJO_EXE}; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
0
|
delete $INC{$path}; |
24
|
0
|
|
|
|
|
0
|
my $app = eval |
25
|
0
|
|
|
|
|
0
|
"package Mojo::Server::Sandbox::@{[md5_sum $path]}; require \$path"; |
26
|
0
|
0
|
|
|
|
0
|
die qq{Can't load application from file "$path": $@} if $@; |
27
|
0
|
0
|
0
|
|
|
0
|
die qq{File "$path" did not return an application object.\n} |
28
|
|
|
|
|
|
|
unless blessed $app && $app->can('handler'); |
29
|
0
|
|
|
|
|
0
|
$self->app($app); |
30
|
|
|
|
|
|
|
}; |
31
|
0
|
|
|
|
|
0
|
FindBin->again; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
0
|
return $self->app; |
34
|
|
|
|
|
|
|
}; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub run { |
38
|
1
|
|
|
1
|
1
|
1959
|
my $self = shift; |
39
|
1
|
|
|
1
|
|
5
|
return sub { $self->call(shift) }; |
|
1
|
|
|
|
|
6
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub call { |
43
|
1
|
|
|
1
|
0
|
3
|
my ($self, $env) = @_; |
44
|
|
|
|
|
|
|
|
45
|
1
|
|
|
|
|
7
|
my $tx = $self->build_tx; |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
101
|
my $req = Mojo::Server::AWSLambda::Request->new; |
48
|
1
|
|
|
|
|
10
|
$req->parse($env); |
49
|
1
|
|
|
|
|
8
|
$tx->req($req); |
50
|
|
|
|
|
|
|
|
51
|
1
|
|
|
|
|
13
|
$self->emit(request => $tx); |
52
|
|
|
|
|
|
|
|
53
|
1
|
|
|
|
|
6194
|
my $res = bless $tx->res, 'Mojo::Server::AWSLambda::Response'; |
54
|
1
|
|
|
|
|
15
|
$res->output; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
__END__ |