AWSLambda.pm

filter: Statementstmt 66.6% 28 / 42 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 88.8% 8 / 9 Podpod 66.6% 2 / 3 totaltotal 60.3% 38 / 63 CC 4 SCAR 19.9
CC
4
Cov
57%
load_app
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 7.3
↑ Summary AWSLambda/Request.pm »
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
BranchTrueFalseTotal
if $@ 0 0 0
27 0 ▶ die qq{File "$path" did not return an application object.\n}
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($app) and $app->can("handler") 0 0 0
Condition0%0/3
builtin::blessed($app) and $app->can("handler")
!ll&&!rl&&r
000
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")
ABresult
0X0
100
111
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__
↑ Summary AWSLambda/Request.pm »