| 1 | package Mojo::Server::AWSLambda; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use Mojo::Base 'Mojo::Server'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use Mojo::Server::AWSLambda::Request; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use Mojo::Server::AWSLambda::Response; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use Mojo::Util qw<monkey_patch md5_sum>; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use Scalar::Util 'blessed'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 2 | our $VERSION = "0.01"; | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 0 | ▶ | sub load_app { | ||||||||||||||||||||||||||
|
Subroutine
load_app: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 15 | 0 | my ($self, $path) = @_; | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | { | ||||||||||||||||||||||||||||
| 18 | 0 | require FindBin; | |||||||||||||||||||||||||||
| 19 | 0 | FindBin->again; | |||||||||||||||||||||||||||
| 20 | 0 | local $ENV{MOJO_APP_LOADER} = 1; | |||||||||||||||||||||||||||
| 21 | 0 | local $ENV{MOJO_EXE}; | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 0 | delete $INC{$path}; | |||||||||||||||||||||||||||
| 24 | 0 | my $app = eval | |||||||||||||||||||||||||||
| 25 | 0 | "package Mojo::Server::Sandbox::@{[md5_sum $path]}; require \$path"; | |||||||||||||||||||||||||||
| 26 | 0 | ▶ | die qq{Can't load application from file "$path": $@} if $@; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 27 | 0 | ▶ | die qq{File "$path" did not return an application object.\n} | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
builtin::blessed($app) and $app->can("handler")
MC/DC0%0/2
builtin::blessed($app) and $app->can("handler")
builtin::blessed($app)
$app->can("handler")
Truth table0%0/3
A and B
A= builtin::blessed($app)B= $app->can("handler")
| |||||||||||||||||||||||||||||
| 28 | unless blessed $app && $app->can('handler'); | ||||||||||||||||||||||||||||
| 29 | 0 | $self->app($app); | |||||||||||||||||||||||||||
| 30 | }; | ||||||||||||||||||||||||||||
| 31 | 0 | FindBin->again; | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 0 | return $self->app; | |||||||||||||||||||||||||||
| 34 | }; | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 1 | ▶ | sub run { | ||||||||||||||||||||||||||
|
Subroutine
run: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 38 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 39 | 1 | ▶ | return sub { $self->call(shift) }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 1 | ▶ | sub call { | ||||||||||||||||||||||||||
|
Subroutine
call: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 43 | 1 | my ($self, $env) = @_; | |||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 1 | my $tx = $self->build_tx; | |||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 1 | my $req = Mojo::Server::AWSLambda::Request->new; | |||||||||||||||||||||||||||
| 48 | 1 | $req->parse($env); | |||||||||||||||||||||||||||
| 49 | 1 | $tx->req($req); | |||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 1 | $self->emit(request => $tx); | |||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 1 | my $res = bless $tx->res, 'Mojo::Server::AWSLambda::Response'; | |||||||||||||||||||||||||||
| 54 | 1 | $res->output; | |||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 2 | 1; | |||||||||||||||||||||||||||
| 58 | __END__ | ||||||||||||||||||||||||||||