blib/lib/Plack/Middleware/ContentLength.pm

filter: Statementstmt 100% 20 / 20 Branchbran 100% 2 / 2 Conditioncond 88.8% 8 / 9 MC/DCmcdc 75.0% 3 / 4 Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 95.2% 40 / 42 CC 5 SCAR 11.0
CC
5
Cov
97%
__ANON__
5.0
call
1.0
BEGIN
1.0
CRAP 3.0
« blib/lib/Plack/Response.pm ↑ Summary blib/lib/Plack/Test.pm »
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
BranchTrueFalseTotal
if (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]))) 586 86 672
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]))
!ll&&!rl&&r
851586
Plack::Util::status_with_no_entity_body($res->[0]) || $h->exists('Content-Length') || $h->exists('Transfer-Encoding')
l!l&&r!l&&!r
850587
Plack::Util::status_with_no_entity_body($res->[0]) or $h->exists("Content-Length")
l!l&&r!l&&!r
1471587
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]))
ABCDresult
1XXX0
01XX0
001X0
00000
00011
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__
« blib/lib/Plack/Response.pm ↑ Summary blib/lib/Plack/Test.pm »