| 1 | package Plack::Middleware::ContentLength; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 43 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 43 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 43 | ▶ | use parent qw( Plack::Middleware ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 43 | ▶ | use Plack::Util; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 709 | ▶ | sub call { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
call: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 709 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 709 | my $res = $self->app->(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 672 | ▶ | return $self->response_cb($res, sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 672 | my $res = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 672 | my $h = Plack::Util::headers($res->[1]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 672 | ▶ | if (!Plack::Util::status_with_no_entity_body($res->[0]) && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition88%8/9
not Plack::Util::status_with_no_entity_body($res->[0]) || $h->exists("Content-Length") || $h->exists("Transfer-Encoding") and defined(my $content_length = Plack::Util::content_length($res->[2]))
Plack::Util::status_with_no_entity_body($res->[0]) || $h->exists('Content-Length') || $h->exists('Transfer-Encoding')
Plack::Util::status_with_no_entity_body($res->[0]) or $h->exists("Content-Length")
MC/DC75%3/4
not Plack::Util::status_with_no_entity_body($res->[0]) || $h->exists("Content-Length") || $h->exists("Transfer-Encoding") and defined(my $content_length = Plack::Util::content_length($res->[2]))
Plack::Util::status_with_no_entity_body($res->[0])
$h->exists("Content-Length")
$h->exists('Transfer-Encoding')
defined(my $content_length = Plack::Util::content_length($res->[2]))
Truth table80%4/5
not(A or B || C) and D
A= Plack::Util::status_with_no_entity_body($res->[0])B= $h->exists("Content-Length")C= $h->exists('Transfer-Encoding')D= defined(my $content_length = Plack::Util::content_length($res->[2]))
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | !$h->exists('Content-Length') && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | !$h->exists('Transfer-Encoding') && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | defined(my $content_length = Plack::Util::content_length($res->[2]))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 586 | $h->push('Content-Length' => $content_length); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 672 | }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 43 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||