blib/lib/Catalyst/Engine/Embeddable.pm

filter: Statementstmt 71.1% 42 / 59 Branchbran 25.0% 1 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 64.2% 9 / 14 Podpod 100% 8 / 8 totaltotal 70.5% 60 / 85 CC 3 SCAR 6.9
CC
3
Cov
68%
finalize_error
6.0
prepare_body
2.0
prepare_headers
2.0
CRAP 2.0
↑ Summary
1 package Catalyst::Engine::Embeddable;
2 3 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use HTTP::Body;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use HTTP::Response;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 extends 'Catalyst::Engine';
9  
10 3 our $VERSION = '0.000003';
11  
12 3 ▶sub prepare_request {
Subroutine prepare_request: called CC=1 SCAR=0.0
Pod documented
13 3 my ($self, $c, $req, $res_ref, $err_ref) = @_;
14 3 $c->req->{_engine_embeddable}{req} = $req;
15 3 $c->req->{_engine_embeddable}{res} = $res_ref;
16 3 $c->req->{_engine_embeddable}{err} = $err_ref;
17 3 $c->req->method($req->method);
18 }
19  
20 0 ▶sub prepare_headers {
Subroutine prepare_headers: not called CC=1 SCAR=6.9
Pod documented
21 0 my ($self, $c) = @_;
22 $c->req->{_engine_embeddable}{req}->scan
23 0 ▶ (sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
24 0 my ($name, $value) = @_;
25 0 $c->req->header($name, $value);
26 0 });
27 }
28  
29 3 ▶sub prepare_path {
Subroutine prepare_path: called CC=1 SCAR=0.0
Pod documented
30 3 my ($self, $c) = @_;
31  
32 3 my $uri = $c->req->{_engine_embeddable}{req}->uri();
33 3 my $base = $uri->clone; $base->path('/'); $base->path_query('');
34  
35 3 $c->req->uri($uri);
36 3 $c->req->base($base);
37 }
38  
39 3 ▶sub prepare_query_parameters {
Subroutine prepare_query_parameters: called CC=1 SCAR=0.0
Pod documented
40 3 my ($self, $c) = @_;
41 3 my %params = $c->req->{_engine_embeddable}{req}->uri->query_form;
42 3 $c->req->query_parameters(\%params);
43 }
44  
45 3 ▶sub prepare_body {
Subroutine prepare_body: called CC=2 SCAR=6.9
Pod documented
46 3 my ($self, $c) = @_;
47 3 my $req = $c->req->{_engine_embeddable}{req};
48 3 ▶ $req->content_length(0) unless $req->content_length;
Branch: 1 branch
BranchTrueFalseTotal
unless $req->content_length 3 0 3
49  
50 3 $c->req->content_encoding($req->content_encoding);
51 3 $c->req->content_type($req->content_type);
52 3 $c->req->content_length($req->content_length);
53  
54 3 my $http_body = HTTP::Body->new($c->req->content_type, $c->req->content_length);
55 3 $http_body->add($req->content());
56 3 $c->req->{_body} = $http_body;
57 }
58  
59 0 ▶sub finalize_error {
Subroutine finalize_error: not called CC=2 SCAR=17.9
Pod documented
60 0 my ($self, $c) = @_;
61  
62 0 $self->next::method($c, @_);
63  
64 0 @{ $c->req->{_engine_embeddable}{err} } = @{ $c->error }
65 0 ▶ if $c->req->{_engine_embeddable}{err};
Branch: 1 branch
BranchTrueFalseTotal
if $c->req->{"_engine_embeddable"}{"err"} 0 0 0
66  
67 0 $c->res->status(500);
68 }
69  
70 0 ▶sub finalize_headers {
Subroutine finalize_headers: not called CC=1 SCAR=6.9
Pod documented
71 0 my ($self, $c) = @_;
72  
73 0 my $response = HTTP::Response->new($c->res->status,
74 'Catalyst-Engine-Embeddable',
75 $c->res->headers);
76  
77 0 ${$c->req->{_engine_embeddable}{res}} = $response;
78 }
79  
80 0 ▶sub finalize_body {
Subroutine finalize_body: not called CC=1 SCAR=6.9
Pod documented
81 0 my ($self, $c) = @_;
82 0 ${$c->req->{_engine_embeddable}{res}}->content($c->res->body());
83 }
84  
85 3 __PACKAGE__->meta->make_immutable;
86 __END__
↑ Summary