blib/lib/HTML/Packer.pm

filter: Statementstmt 83.1% 148 / 178 Branchbran 74.5% 76 / 102 Conditioncond 55.5% 15 / 27 MC/DCmcdc 33.3% 6 / 18 Subroutinesub 92.8% 26 / 28 Podpod 33.3% 2 / 6 totaltotal 76.0% 273 / 359 CC 61 SCAR 26.3
CC
61
Cov
78%
minify
34.2
__ANON__
25.0
__ANON__
6.0
CRAP 13.9
↑ Summary
1 package HTML::Packer;
2  
3 3 ▶use 5.008009;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use Regexp::RegGrp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 # -----------------------------------------------------------------------------
10  
11 3 our $VERSION = '1.003_001';
12  
13 3 our @BOOLEAN_ACCESSORS = (
14 'remove_comments',
15 'remove_newlines',
16 'no_compress_comment',
17 'html5',
18 );
19  
20 3 our @JAVASCRIPT_OPTS = ( 'clean', 'obfuscate', 'shrink', 'best' );
21 3 our @CSS_OPTS = ( 'minify', 'pretty' );
22  
23 3 our $REQUIRED_JAVASCRIPT_PACKER = '1.002001';
24 3 our $REQUIRED_CSS_PACKER = '1.000001';
25  
26 3 our @SAVE_SPACE_ELEMENTS = (
27 'a', 'abbr', 'acronym', 'address', 'b', 'bdo', 'big', 'button', 'cite',
28 'del', 'dfn', 'em', 'font', 'i', 'input', 'ins', 'kbd', 'label', 'q',
29 's', 'samp', 'select', 'small', 'strike', 'strong', 'sub', 'sup', 'u', 'var'
30 );
31  
32 3 our @VOID_ELEMENTS = (
33 'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input',
34 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'
35 );
36  
37 # Some regular expressions are from HTML::Clean
38  
39 3 our $COMMENT = '((?>\s*))(<!--(?:(?![#\[]| google_ad_section_).*?)?-->)((?>\s*))';
40  
41 3 our $PACKER_COMMENT = '<!--\s*HTML::Packer\s*(\w+)\s*-->';
42  
43 3 our $DOCTYPE = '<\!DOCTYPE[^>]*>';
44  
45 3 our $DONT_CLEAN = '(<\s*(pre|code|textarea|script|style)[^>]*>)(.*?)(<\s*\/\2[^>]*>)';
46  
47 our $WHITESPACES = [
48 {
49 regexp => qr/^\s*/s,
50 replacement => ''
51 },
52 {
53 regexp => qr/\s*$/s,
54 replacement => ''
55 },
56 {
57 regexp => '^\s*',
58 replacement => '',
59 modifier => 'm'
60 },
61 {
62 regexp => '[^\S\n]*$',
63 replacement => '',
64 modifier => 'm'
65 },
66 {
67 regexp => qr/(?<=>)[^<>]*(?=<)/sm,
68 replacement => sub {
69 50 ▶ my $match = $_[0]->{match};
Subroutine __ANON__: called CC=1 SCAR=0.0
70  
71 50 $match =~ s/[^\S\n]{2,}/ /sg;
72 50 $match =~ s/\s*\n+\s*/\n/sg;
73  
74 50 return $match;
75 }
76 },
77 {
78 regexp => '<\s*(\/)?\s*',
79 replacement => sub {
80 70 ▶ return sprintf( '<%s', $_[0]->{submatches}->[0] );
Subroutine __ANON__: called CC=1 SCAR=0.0
81 },
82 modifier => 's'
83 },
84 {
85 regexp => '\s*(\/)?\s*>',
86 replacement => sub {
87 70 ▶ return sprintf( '%s>', $_[0]->{submatches}->[0] );
Subroutine __ANON__: called CC=1 SCAR=0.0
88 },
89 3 modifier => 's'
90 }
91 ];
92  
93 our $NEWLINES_TAGS = [
94 {
95 regexp => '(\s*)(<\s*\/?\s*(?:' . join( '|', @SAVE_SPACE_ELEMENTS ) . ')\b[^>]*>)(\s*)',
96 replacement => sub {
97 32 ▶ return sprintf( '%s%s%s', $_[0]->{submatches}->[0] ? ' ' : '', $_[0]->{submatches}->[1], $_[0]->{submatches}->[2] ? ' ' : '' );
Subroutine __ANON__: called CC=3 SCAR=11.0
Branch: 2 branches
BranchTrueFalseTotal
$_[0]{'submatches'}[0] ? : 21 11 32
$_[0]{'submatches'}[2] ? : 15 17 32
98 },
99 3 modifier => 'is'
100 }
101 ];
102  
103 our $NEWLINES = [
104 {
105 regexp => '(.)\n(.)',
106 replacement => sub {
107 10 ▶ my ( $pre, $post ) = @{$_[0]->{submatches}};
Subroutine __ANON__: called CC=5 SCAR=17.1
108  
109 10 my $ret;
110  
111 10 ▶ if ( $pre eq '>' or $post eq '<' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($pre eq '>' or $post eq '<') { } 2 8 10
elsif ($pre =~ /[\w-]/ and $post =~ /[\w-]/) { } 8 0 8
Condition66%2/3
$pre eq ">" or $post eq "<"
l!l&&r!l&&!r
208
MC/DC50%1/2
$pre eq ">" or $post eq "<"
$pre eq ">" $post eq "<"
Truth table66%2/3
A or B
A= $pre eq ">"B= $post eq "<"
ABresult
1X1
011
000
112 2 $ret = $pre . $post;
113 }
114 ▶ elsif ( $pre =~ /[\w-]/ and $post =~ /[\w-]/ ) {
Condition33%1/3
$pre =~ /[\w-]/ and $post =~ /[\w-]/
!ll&&!rl&&r
008
MC/DC0%0/2
$pre =~ /[\w-]/ and $post =~ /[\w-]/
$pre =~ /[\w-]/ $post =~ /[\w-]/
Truth table33%1/3
A and B
A= $pre =~ /[\w-]/B= $post =~ /[\w-]/
ABresult
0X0
100
111
115 8 $ret = $pre . ' ' . $post;
116 }
117 else {
118 0 $ret = $pre . $post;
119 }
120  
121 10 return $ret;
122 }
123 }
124 3 ];
125  
126 3 our @REGGRPS = ( 'newlines', 'newlines_tags', 'whitespaces', 'void_elements' );
127  
128 3 our $GLOBAL_REGGRP = 'global';
129  
130 ##########################################################################################
131  
132 {
133 3 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
134  
135 3 foreach my $field ( @BOOLEAN_ACCESSORS ) {
136 12 ▶ next if defined *{ __PACKAGE__ . '::' . $field }{CODE};
Branch: 1 branch
BranchTrueFalseTotal
if defined *{'HTML::Packer::' . $field;}{"CODE"} 0 12 12
137  
138 12 *{ __PACKAGE__ . '::' . $field} = sub {
139 146 ▶ my ( $self, $value ) = @_;
Subroutine __ANON__: called CC=3 SCAR=11.0
140  
141 146 ▶ $self->{'_' . $field} = $value ? 1 : undef if ( defined( $value ) );
Branch: 2 branches
BranchTrueFalseTotal
if defined $value 35 111 146
$value ? : 30 5 35
142  
143 146 return $self->{'_' . $field};
144 12 };
145 }
146  
147 3 foreach my $reggrp ( @REGGRPS, $GLOBAL_REGGRP ) {
148 15 ▶ next if defined *{ __PACKAGE__ . '::reggrp_' . $reggrp }{CODE};
Branch: 1 branch
BranchTrueFalseTotal
if defined *{'HTML::Packer::reggrp_' . $reggrp;}{"CODE"} 0 15 15
149  
150 15 *{ __PACKAGE__ . '::reggrp_' . $reggrp } = sub {
151 68 ▶ my ( $self ) = shift;
Subroutine __ANON__: called CC=1 SCAR=0.0
152  
153 68 return $self->{ '_reggrp_' . $reggrp };
154 15 };
155 }
156 }
157  
158 sub do_javascript {
159 19 ▶ my ( $self, $value ) = @_;
Subroutine do_javascript: called CC=4 SCAR=13.9
Pod documented
160  
161 19 ▶ if ( defined( $value ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 10 9 19
162 10 ▶ if ( grep( $value eq $_, @JAVASCRIPT_OPTS ) ) {
Branch: 2 branches
BranchTrueFalseTotal
if (grep(($value eq $_), @HTML::Packer::JAVASCRIPT_OPTS)) { } 7 3 10
elsif (not $value) { } 1 2 3
163 7 $self->{_do_javascript} = $value;
164 }
165 elsif ( ! $value ) {
166 1 $self->{_do_javascript} = undef;
167 }
168 }
169  
170 19 return $self->{_do_javascript};
171 }
172  
173 sub do_stylesheet {
174 16 ▶ my ( $self, $value ) = @_;
Subroutine do_stylesheet: called CC=4 SCAR=13.9
Pod documented
175  
176 16 ▶ if ( defined( $value ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 8 8 16
177 8 ▶ if ( grep( $value eq $_, @CSS_OPTS ) ) {
Branch: 2 branches
BranchTrueFalseTotal
if (grep(($value eq $_), @HTML::Packer::CSS_OPTS)) { } 5 3 8
elsif (not $value) { } 1 2 3
178 5 $self->{_do_stylesheet} = $value;
179 }
180 elsif ( ! $value ) {
181 1 $self->{_do_stylesheet} = undef;
182 }
183 }
184  
185 16 return $self->{_do_stylesheet};
186 }
187  
188 sub init {
189 8 ▶ my $class = shift;
Subroutine init: called CC=2 SCAR=7.4
Pod undocumented
190 8 my $self = {};
191  
192 8 bless( $self, $class );
193  
194 8 $self->{whitespaces}->{reggrp_data} = $WHITESPACES;
195 8 $self->{newlines}->{reggrp_data} = $NEWLINES;
196 8 $self->{newlines_tags}->{reggrp_data} = $NEWLINES_TAGS;
197 $self->{global}->{reggrp_data} = [
198 {
199 regexp => $DOCTYPE,
200 replacement => sub {
201 0 ▶ return '<!--~' . $_[0]->{store_index} . '~-->';
Subroutine __ANON__: not called CC=1 SCAR=6.9
202 },
203 store => sub {
204 0 ▶ my $doctype = $_[0]->{match};
Subroutine __ANON__: not called CC=1 SCAR=6.9
205  
206 0 $doctype =~ s/\s+/ /gsm;
207  
208 0 return $doctype;
209 }
210 },
211 {
212 regexp => $COMMENT,
213 replacement => sub {
214 return $self->remove_comments() ? (
215 $self->remove_newlines() ? ' ' : (
216 ( $_[0]->{submatches}->[0] =~ /\n/s or $_[0]->{submatches}->[2] =~ /\n/s ) ? "\n" : ''
217 )
218 12 ▶ ) : '<!--~' . $_[0]->{store_index} . '~-->';
Subroutine __ANON__: called CC=5 SCAR=17.4
Branch: 3 branches
BranchTrueFalseTotal
$self->remove_comments ? : 9 3 12
$self->remove_newlines ? : 8 1 9
$_[0]{'submatches'}[0] =~ /\n/s || $_[0]{'submatches'}[2] =~ /\n/s ? : 1 0 1
Condition33%1/3
$_[0]{"submatches"}[0] =~ /\n/s or $_[0]{"submatches"}[2] =~ /\n/s
l!l&&r!l&&!r
100
MC/DC0%0/2
$_[0]{"submatches"}[0] =~ /\n/s or $_[0]{"submatches"}[2] =~ /\n/s
$_[0]{"submatches"}[0] =~ /\n/s $_[0]{"submatches"}[2] =~ /\n/s
Truth table33%1/3
A or B
A= $_[0]{"submatches"}[0] =~ /\n/sB= $_[0]{"submatches"}[2] =~ /\n/s
ABresult
1X1
011
000
219 },
220 store => sub {
221 my $ret = $self->remove_comments() ? '' : (
222 ( ( not $self->remove_newlines() and $_[0]->{submatches}->[0] =~ /\n/s ) ? "\n" : '' ) .
223 $_[0]->{submatches}->[1] .
224 12 ▶ ( ( not $self->remove_newlines() and $_[0]->{submatches}->[2] =~ /\n/s ) ? "\n" : '' )
Subroutine __ANON__: called CC=6 SCAR=17.9
Branch: 3 branches
BranchTrueFalseTotal
$self->remove_comments ? : 9 3 12
!$self->remove_newlines && $_[0]{'submatches'}[0] =~ /\n/s ? : 2 1 3
!$self->remove_newlines && $_[0]{'submatches'}[2] =~ /\n/s ? : 1 2 3
Condition83%5/6
not $self->remove_newlines and $_[0]{"submatches"}[0] =~ /\n/s
!ll&&!rl&&r
102
not $self->remove_newlines and $_[0]{"submatches"}[2] =~ /\n/s
!ll&&!rl&&r
111
MC/DC50%1/2
not $self->remove_newlines and $_[0]{"submatches"}[0] =~ /\n/s
not $self->remove_newlines $_[0]{"submatches"}[0] =~ /\n/s
MC/DC100%2/2
not $self->remove_newlines and $_[0]{"submatches"}[2] =~ /\n/s
not $self->remove_newlines $_[0]{"submatches"}[2] =~ /\n/s
Truth table66%2/3
not(A) and B
A= not $self->remove_newlinesB= $_[0]{"submatches"}[0] =~ /\n/s
ABresult
0X0
100
111
Truth table100%3/3
not(A) and B
A= not $self->remove_newlinesB= $_[0]{"submatches"}[2] =~ /\n/s
ABresult
0X0
100
111
225 );
226  
227 12 return $ret;
228 }
229 },
230 {
231 regexp => $DONT_CLEAN,
232 replacement => sub {
233 5 ▶ return '<!--~' . $_[0]->{store_index} . '~-->';
Subroutine __ANON__: called CC=1 SCAR=0.0
234 },
235 store => sub {
236 5 ▶ my ( $opening, undef, $content, $closing ) = @{$_[0]->{submatches}};
Subroutine __ANON__: called CC=14 SCAR=32.2
237  
238 5 ▶ if ( $content ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($content) { } 5 0 5
239 5 ▶ my $opening_script_re = '<\s*script' . ( $self->html5() ? '[^>]*>' : '[^>]*(?:java|ecma)script[^>]*>' );
Branch: 1 branch
BranchTrueFalseTotal
$self->html5 ? : 3 2 5
240 5 ▶ my $opening_style_re = '<\s*style' . ( $self->html5() ? '[^>]*>' : '[^>]*text\/css[^>]*>' );
Branch: 1 branch
BranchTrueFalseTotal
$self->html5 ? : 3 2 5
241  
242 5 ▶ if ( $opening =~ /$opening_script_re/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($opening =~ /$opening_script_re/i) { } 3 2 5
elsif ($opening =~ /$opening_style_re/i) { } 2 0 2
243 3 ▶ $opening =~ s/ type="(text\/)?(java|ecma)script"//i if ( $self->html5() );
Branch: 1 branch
BranchTrueFalseTotal
if $self->html5 2 1 3
244  
245 3 ▶ if ( $self->javascript_packer() and $self->do_javascript() ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->javascript_packer and $self->do_javascript) 0 3 3
Condition33%1/3
$self->javascript_packer and $self->do_javascript
!ll&&!rl&&r
300
MC/DC0%0/2
$self->javascript_packer and $self->do_javascript
$self->javascript_packer $self->do_javascript
Truth table33%1/3
A and B
A= $self->javascript_packerB= $self->do_javascript
ABresult
0X0
100
111
246 0 $self->javascript_packer()->minify( \$content, { compress => $self->do_javascript() } );
247  
248 0 ▶ unless ( $self->html5() ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->html5) 0 0 0
249 0 $content = '/*<![CDATA[*/' . $content . '/*]]>*/';
250 }
251 }
252 }
253 elsif ( $opening =~ /$opening_style_re/i ) {
254 2 ▶ $opening =~ s/ type="text\/css"//i if ( $self->html5() );
Branch: 1 branch
BranchTrueFalseTotal
if $self->html5 1 1 2
255  
256 2 ▶ if ( $self->css_packer() and $self->do_stylesheet() ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->css_packer and $self->do_stylesheet) 0 2 2
Condition33%1/3
$self->css_packer and $self->do_stylesheet
!ll&&!rl&&r
200
MC/DC0%0/2
$self->css_packer and $self->do_stylesheet
$self->css_packer $self->do_stylesheet
Truth table33%1/3
A and B
A= $self->css_packerB= $self->do_stylesheet
ABresult
0X0
100
111
257 0 $self->css_packer()->minify( \$content, { compress => $self->do_stylesheet() } );
258 0 ▶ $content = "\n" . $content if ( $self->do_stylesheet() eq 'pretty' );
Branch: 1 branch
BranchTrueFalseTotal
if $self->do_stylesheet eq "pretty" 0 0 0
259 }
260 }
261 }
262 else {
263 0 $content = '';
264 }
265  
266 5 $self->reggrp_whitespaces()->exec( \$opening );
267 5 $self->reggrp_whitespaces()->exec( \$closing );
268  
269 5 return $opening . $content . $closing;
270 },
271 8 modifier => 'ism'
272 }
273 ];
274  
275 $self->{void_elements}->{reggrp_data} = [
276 {
277 regexp => '<\s*((?:' . join( '|', @VOID_ELEMENTS ) . ')\b[^>]*)\s*\/>',
278 replacement => sub {
279 2 ▶ return '<' . $_[0]->{submatches}->[0] . '>';
Subroutine __ANON__: called CC=1 SCAR=0.0
280 },
281 8 modifier => 'ism'
282 }
283 ];
284  
285 8 foreach ( @HTML::Packer::REGGRPS ) {
286 32 $self->{ '_reggrp_' . $_ } = Regexp::RegGrp->new( { reggrp => $self->{$_}->{reggrp_data} } );
287 }
288  
289 $self->{ '_reggrp_' . $GLOBAL_REGGRP } = Regexp::RegGrp->new(
290 {
291 reggrp => $self->{$GLOBAL_REGGRP}->{reggrp_data},
292 8 restore_pattern => qr/<!--~(\d+)~-->/
293 }
294 );
295  
296 8 return $self;
297 }
298  
299 sub minify {
300 13 ▶ my ( $self, $input, $opts );
Subroutine minify: called CC=20 SCAR=35.3
Pod undocumented
301  
302 13 ▶ unless (
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_[0] and ref $_[0] eq __PACKAGE__) { } 13 0 13
Condition33%1/3
ref $_[0] and ref $_[0] eq __PACKAGE__
!ll&&!rl&&r
0013
MC/DC0%0/2
ref $_[0] and ref $_[0] eq __PACKAGE__
ref $_[0] ref $_[0] eq __PACKAGE__
Truth table33%1/3
A and B
A= ref $_[0]B= ref $_[0] eq __PACKAGE__
ABresult
0X0
100
111
303 ref( $_[0] ) and
304 ref( $_[0] ) eq __PACKAGE__
305 ) {
306 0 $self = __PACKAGE__->init();
307  
308 0 ▶ shift( @_ ) unless ( ref( $_[0] ) );
Branch: 1 branch
BranchTrueFalseTotal
unless ref $_[0] 0 0 0
309  
310 0 ( $input, $opts ) = @_;
311 }
312 else {
313 13 ( $self, $input, $opts ) = @_;
314 }
315  
316 13 ▶ if ( ref( $input ) ne 'SCALAR' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $input ne "SCALAR") 0 13 13
317 0 carp( 'First argument must be a scalarref!' );
318 0 return undef;
319 }
320  
321 13 my $html;
322 13 my $cont = 'void';
323  
324 13 ▶ if ( defined( wantarray ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined wantarray) { } 0 13 13
325 0 ▶ my $tmp_input = ref( $input ) ? ${$input} : $input;
Branch: 1 branch
BranchTrueFalseTotal
ref $input ? : 0 0 0
326  
327 0 $html = \$tmp_input;
328 0 $cont = 'scalar';
329 }
330 else {
331 13 ▶ $html = ref( $input ) ? $input : \$input;
Branch: 1 branch
BranchTrueFalseTotal
ref $input ? : 13 0 13
332 }
333  
334 13 ▶ if ( ref( $opts ) eq 'HASH' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $opts eq "HASH") 13 0 13
335 13 foreach my $field ( @BOOLEAN_ACCESSORS ) {
336 52 ▶ $self->$field( $opts->{$field} ) if ( defined( $opts->{$field} ) );
Branch: 1 branch
BranchTrueFalseTotal
if defined $opts->{$field} 27 25 52
337 }
338  
339 13 ▶ $self->do_javascript( $opts->{do_javascript} ) if ( defined( $opts->{do_javascript} ) );
Branch: 1 branch
BranchTrueFalseTotal
if defined $opts->{"do_javascript"} 4 9 13
340 13 ▶ $self->do_stylesheet( $opts->{do_stylesheet} ) if ( defined( $opts->{do_stylesheet} ) );
Branch: 1 branch
BranchTrueFalseTotal
if defined $opts->{"do_stylesheet"} 3 10 13
341 }
342  
343 13 ▶ if ( not $self->no_compress_comment() and ${$html} =~ /$PACKER_COMMENT/s ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->no_compress_comment and ${$html;} =~ /$PACKER_COMMENT/s) 1 12 13
Condition100%3/3
not $self->no_compress_comment and ${$html;} =~ /$PACKER_COMMENT/s
!ll&&!rl&&r
2101
MC/DC100%2/2
not $self->no_compress_comment and ${$html;} =~ /$PACKER_COMMENT/s
not $self->no_compress_comment ${$html;} =~ /$PACKER_COMMENT/s
Truth table100%3/3
not(A) and B
A= not $self->no_compress_commentB= ${$html;} =~ /$PACKER_COMMENT/s
ABresult
0X0
100
111
344 1 my $compress = $1;
345 1 ▶ if ( $compress eq '_no_compress_' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($compress eq "_no_compress_") 1 0 1
346 1 ▶ return ( $cont eq 'scalar' ) ? ${$html} : undef;
Branch: 1 branch
BranchTrueFalseTotal
$cont eq 'scalar' ? : 0 1 1
347 }
348 }
349  
350 12 $self->reggrp_global()->exec( $html );
351 12 $self->reggrp_whitespaces()->exec( $html );
352 12 ▶ if ( $self->remove_newlines() ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->remove_newlines) 9 3 12
353 9 $self->reggrp_newlines_tags()->exec( $html );
354 9 $self->reggrp_newlines()->exec( $html );
355 }
356 12 ▶ if ( $self->html5() ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->html5) 4 8 12
357 4 $self->reggrp_void_elements()->exec( $html );
358 }
359  
360 12 $self->reggrp_global()->restore_stored( $html );
361  
362 12 ▶ return ${$html} if ( $cont eq 'scalar' );
Branch: 1 branch
BranchTrueFalseTotal
if $cont eq "scalar" 0 12 12
363 }
364  
365 sub javascript_packer {
366 4 ▶ my $self = shift;
Subroutine javascript_packer: called CC=3 SCAR=12.0
Pod undocumented
367  
368 4 ▶ unless ( $self->{_checked_javascript_packer} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"_checked_javascript_packer"}) 2 2 4
369 2 ▶ eval "use JavaScript::Packer $REQUIRED_JAVASCRIPT_PACKER;";
Subroutine BEGIN: called CC=1 SCAR=1.2
370  
371 2 ▶ unless ( $@ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($@) 0 2 2
372 0 $self->{_javascript_packer} = eval {
373 0 JavaScript::Packer->init();
374 };
375 }
376  
377 2 $self->{_checked_javascript_packer} = 1;
378 }
379  
380 4 return $self->{_javascript_packer};
381 }
382  
383 sub css_packer {
384 3 ▶ my $self = shift;
Subroutine css_packer: called CC=3 SCAR=12.0
Pod undocumented
385  
386 3 ▶ unless ( $self->{_checked_css_packer} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"_checked_css_packer"}) 2 1 3
387 2 ▶ eval "use CSS::Packer $REQUIRED_CSS_PACKER;";
Subroutine BEGIN: called CC=1 SCAR=1.2
388  
389 2 ▶ unless ( $@ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($@) 0 2 2
390 0 $self->{_css_packer} = eval {
391 0 CSS::Packer->init();
392 };
393 }
394  
395 2 $self->{_checked_css_packer} = 1;
396 }
397  
398 3 return $self->{_css_packer};
399 }
400  
401 3 1;
402  
403 __END__
↑ Summary