| 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
| |||||||||||||
| 14 | 0 | return $c->next::method(@_); | |||||||||||
| 15 | } | ||||||||||||
| 16 | |||||||||||||
| 17 | 0 | ▶ | unless ( $c->response->body ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 18 | 0 | return $c->next::method(@_); | |||||||||||
| 19 | } | ||||||||||||
| 20 | |||||||||||||
| 21 | 0 | ▶ | unless ( $c->response->status == 200 ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 22 | 0 | return $c->next::method(@_); | |||||||||||
| 23 | } | ||||||||||||
| 24 | |||||||||||||
| 25 | 0 | ▶ | unless ( $c->response->content_type =~ /^text|xml$|javascript$/ ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 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') || ''
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')
| |||||||||||||
| 30 | |||||||||||||
| 31 | 0 | ▶ | unless ( index( $accept, "bzip2" ) >= 0 ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 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__ | ||||||||||||