blib/lib/Catalyst/Plugin/Compress/Bzip2.pm

filter: Statementstmt 45.1% 14 / 31 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 80.0% 4 / 5 Podpod 100% 1 / 1 totaltotal 38.0% 19 / 50 CC 7 SCAR 35.8
CC
7
Cov
33%
finalize
56.0
BEGIN
1.0
BEGIN
1.0
CRAP 36.0
↑ Summary
1 package Catalyst::Plugin::Compress::Bzip2;
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use MRO::Compat;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Compress::Bzip2 2.0 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 our $VERSION = '0.05';
9  
10 0 ▶sub finalize {
Subroutine finalize: not called CC=7 SCAR=40.3
Pod documented
11 0 my $c = shift;
12  
13 0 ▶ if ( $c->response->content_encoding ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c->response->content_encoding) 0 0 0
14 0 return $c->next::method(@_);
15 }
16  
17 0 ▶ unless ( $c->response->body ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($c->response->body) 0 0 0
18 0 return $c->next::method(@_);
19 }
20  
21 0 ▶ unless ( $c->response->status == 200 ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($c->response->status == 200) 0 0 0
22 0 return $c->next::method(@_);
23 }
24  
25 0 ▶ unless ( $c->response->content_type =~ /^text|xml$|javascript$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($c->response->content_type =~ /^text|xml$|javascript$/) 0 0 0
26 0 return $c->next::method(@_);
27 }
28  
29 0 ▶ my $accept = $c->request->header('Accept-Encoding') || '';
Condition0%0/2
$c->request->header('Accept-Encoding') || ''
l!l
00
MC/DC0%0/1
$c->request->header('Accept-Encoding') || ''
$c->request->header('Accept-Encoding')
Truth table0%0/2
A
A= $c->request->header('Accept-Encoding')
Aresult
11
00
30  
31 0 ▶ unless ( index( $accept, "bzip2" ) >= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (index($accept, "bzip2") != -1) 0 0 0
32 0 return $c->next::method(@_);
33 }
34  
35 0 $c->response->body( Compress::Bzip2::memBzip( $c->response->body ) );
36 0 $c->response->content_length( length( $c->response->body ) );
37 0 $c->response->content_encoding('bzip2');
38 0 $c->response->headers->push_header( 'Vary', 'Accept-Encoding' );
39  
40 0 $c->next::method(@_);
41 }
42  
43 1 1;
44  
45 __END__
↑ Summary