| 1 | package App::ZofCMS::Plugin::JavaScriptMinifier; | ||||||||||||||||||||||||||||
| 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 JavaScript::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_js_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 | 0 | ▶ | sub _do { | ||||||||||||||||||||||||||
|
Subroutine
_do: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||
| 18 | 0 | my ( $self, $conf, $t ) = @_; | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | return | ||||||||||||||||||||||||||||
| 21 | unless defined $conf->{file} | ||||||||||||||||||||||||||||
| 22 | 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"}
| |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | -e $conf->{file} | ||||||||||||||||||||||||||||
| 25 | 0 | ▶ | or die "$conf->{file} was not found"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | open my $fh, '<', $conf->{file} | ||||||||||||||||||||||||||||
| 28 | 0 | ▶ | or die "$conf->{file} could not be opened for reading: $!"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 0 | my $js = minify( input => $fh ); | |||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 0 | ▶ | if ( $conf->{auto_output} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 33 | 0 | ▶ | if ( $conf->{cache} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 34 | 0 | print "Expires: Fri, 29 Oct 2038 14:19:41 GMT\n" | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | 0 | print "Content-type: text/javascript\n\n"; | |||||||||||||||||||||||||||
| 37 | 0 | print $js; | |||||||||||||||||||||||||||
| 38 | 0 | exit; | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | else { | ||||||||||||||||||||||||||||
| 41 | 0 | $t->{t}{plug_js_minifier} = $js; | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | 1 | 1; | |||||||||||||||||||||||||||
| 45 | __END__ | ||||||||||||||||||||||||||||