| 1 | package App::ZofCMS::Plugin::CSSMinifier; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 1 | our $VERSION = '1.001010'; # VERSION | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use CSS::Minifier qw/minify/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use base 'App::ZofCMS::Plugin::Base'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 0 | ▶ | sub _key { 'plug_css_minifier' } | ||||||||||||||||||||||||||
|
Subroutine
_key: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 12 | 0 | ▶ | sub _defaults { | ||||||||||||||||||||||||||
|
Subroutine
_defaults: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 13 | 0 | auto_output => 1, | |||||||||||||||||||||||||||
| 14 | cache => 1, | ||||||||||||||||||||||||||||
| 15 | file => undef, | ||||||||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 0 | ▶ | sub _do { | ||||||||||||||||||||||||||
|
Subroutine
_do: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||
| 19 | 0 | my ( $self, $conf, $t ) = @_; | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | return | ||||||||||||||||||||||||||||
| 22 | unless defined $conf->{file} | ||||||||||||||||||||||||||||
| 23 | 0 | ▶ | and length $conf->{file}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $conf->{"file"} and length $conf->{"file"}
MC/DC0%0/2
defined $conf->{"file"} and length $conf->{"file"}
defined $conf->{"file"}
length $conf->{"file"}
Truth table0%0/3
A and B
A= defined $conf->{"file"}B= length $conf->{"file"}
| |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | -e $conf->{file} | ||||||||||||||||||||||||||||
| 26 | 0 | ▶ | or die "$conf->{file} was not found"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | open my $fh, '<', $conf->{file} | ||||||||||||||||||||||||||||
| 29 | 0 | ▶ | or die "$conf->{file} could not be opened for reading: $!"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 0 | my $css = minify( input => $fh ); | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 0 | ▶ | if ( $conf->{auto_output} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 34 | 0 | ▶ | if ( $conf->{cache} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | 0 | print "Expires: Fri, 29 Oct 2038 14:19:41 GMT\n" | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | 0 | print "Content-type: text/css\n\n"; | |||||||||||||||||||||||||||
| 38 | 0 | print $css; | |||||||||||||||||||||||||||
| 39 | 0 | exit; | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | else { | ||||||||||||||||||||||||||||
| 42 | 0 | $t->{t}{plug_css_minifier} = $css; | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | 1 | 1; | |||||||||||||||||||||||||||
| 46 | __END__ | ||||||||||||||||||||||||||||