ZofCMS/Plugin/CSSMinifier.pm

filter: Statementstmt 50.0% 14 / 28 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 57.1% 4 / 7 Podpod n/a totaltotal 36.0% 18 / 50 CC 7 SCAR 34.3
CC
7
Cov
34%
_do
56.0
_key
2.0
_defaults
2.0
CRAP 30.8
« ZofCMS/Plugin/UserLogin/ForgotPassword.pm ↑ Summary ZofCMS/Plugin/JavaScriptMinifier.pm »
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
BranchTrueFalseTotal
unless defined $conf->{"file"} and length $conf->{"file"} 0 0 0
Condition0%0/3
defined $conf->{"file"} and length $conf->{"file"}
!ll&&!rl&&r
000
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"}
ABresult
0X0
100
111
24  
25 -e $conf->{file}
26 0 ▶ or die "$conf->{file} was not found";
Branch: 1 branch
BranchTrueFalseTotal
-e $conf->{"file"} or die qq[$conf->{"file"} was not found] 0 0 0
27  
28 open my $fh, '<', $conf->{file}
29 0 ▶ or die "$conf->{file} could not be opened for reading: $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "<", $conf->{"file"} or die qq[$conf->{"file"} could not be opened for reading: $!] 0 0 0
30  
31 0 my $css = minify( input => $fh );
32  
33 0 ▶ if ( $conf->{auto_output} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{'auto_output'}) { } 0 0 0
34 0 ▶ if ( $conf->{cache} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($conf->{"cache"}) 0 0 0
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__
« ZofCMS/Plugin/UserLogin/ForgotPassword.pm ↑ Summary ZofCMS/Plugin/JavaScriptMinifier.pm »