JavaScript/Minifier.pm

filter: Statementstmt 52.6% 20 / 38 Branchbran 0.0% 0 / 36 Conditioncond 0.0% 0 / 17 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 66.6% 6 / 9 Podpod 100% 1 / 1 totaltotal 25.0% 27 / 108 CC 23 SCAR 60.2
CC
23
Cov
22%
_process_request
552.0
_methods_define
2.0
minify
2.0
CRAP 409.9
↑ Summary CSS/Minifier.pm »
1 package POE::Component::JavaScript::Minifier;
2  
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 our $VERSION = '2.001002'; # VERSION
7  
8 2 ▶use POE;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use base 'POE::Component::NonBlockingWrapper::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use JavaScript::Minifier 1.10 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use LWP::UserAgent;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 0 ▶sub _methods_define {
Subroutine _methods_define: not called CC=1 SCAR=6.9
14 0 return ( minify => '_wheel_entry' );
15 }
16  
17 0 ▶sub minify {
Subroutine minify: not called CC=1 SCAR=6.9
Pod documented
18 0 $poe_kernel->post( shift->{session_id} => minify => @_ );
19 }
20  
21 0 ▶sub _process_request {
Subroutine _process_request: not called CC=23 SCAR=63.1
22 0 my ( $self, $in_ref ) = @_;
23  
24 0 ▶ if ( defined $in_ref->{infile} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $in_ref->{'infile'}) { } 0 0 0
elsif ($in_ref->{'uri'}) { } 0 0 0
25 open my $in, '<', $in_ref->{infile}
26 0 ▶ or $in_ref->{error} = "infile error [$!]"
Branch: 1 branch
BranchTrueFalseTotal
open my $in, "<", $in_ref->{"infile"} or $in_ref->{"error"} = "infile error [$!]" and return 0 0 0
Condition0%0/5
open(my $in, '<', $in_ref->{'infile'}) || ($in_ref->{'error'} = "infile error [$!]") && (return)
l!l&&r!l&&!r
000
$in_ref->{"error"} = "infile error [$!]" and return
!ll
00
MC/DC0%0/2
open(my $in, '<', $in_ref->{'infile'}) || ($in_ref->{'error'} = "infile error [$!]") && (return)
open(my $in, '<', $in_ref->{'infile'}) $in_ref->{"error"} = "infile error [$!]"
Truth table0%0/3
A || B
A= open(my $in, '<', $in_ref->{'infile'})B= $in_ref->{"error"} = "infile error [$!]"
ABresult
1X1
011
000
27 and return;
28  
29 0 ▶ if ( defined $in_ref->{outfile} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $in_ref->{'outfile'}) { } 0 0 0
30 open my $out, '>', $in_ref->{outfile}
31 0 ▶ or $in_ref->{error} = "outfile error [$!]"
Branch: 1 branch
BranchTrueFalseTotal
open my $out, ">", $in_ref->{"outfile"} or $in_ref->{"error"} = "outfile error [$!]" and return 0 0 0
Condition0%0/5
open(my $out, '>', $in_ref->{'outfile'}) || ($in_ref->{'error'} = "outfile error [$!]") && (return)
l!l&&r!l&&!r
000
$in_ref->{"error"} = "outfile error [$!]" and return
!ll
00
MC/DC0%0/2
open(my $out, '>', $in_ref->{'outfile'}) || ($in_ref->{'error'} = "outfile error [$!]") && (return)
open(my $out, '>', $in_ref->{'outfile'}) $in_ref->{"error"} = "outfile error [$!]"
Truth table0%0/3
A || B
A= open(my $out, '>', $in_ref->{'outfile'})B= $in_ref->{"error"} = "outfile error [$!]"
ABresult
1X1
011
000
32 and return;
33  
34 JavaScript::Minifier::minify(
35 input => $in,
36 outfile => $out,
37 ( $in_ref->{stripDebug} ? ( $in_ref->{stripDebug} ) : () ),
38 0 ▶ ( $in_ref->{copyright} ? ( $in_ref->{copyright} ) : () ),
Branch: 2 branches
BranchTrueFalseTotal
$in_ref->{'stripDebug'} ? : 0 0 0
$in_ref->{'copyright'} ? : 0 0 0
39 );
40 }
41 else {
42 $in_ref->{out} = JavaScript::Minifier::minify(
43 input => $in,
44 ( $in_ref->{stripDebug} ? ( $in_ref->{stripDebug} ) : () ),
45 0 ▶ ( $in_ref->{copyright} ? ( $in_ref->{copyright} ) : () ),
Branch: 2 branches
BranchTrueFalseTotal
$in_ref->{'stripDebug'} ? : 0 0 0
$in_ref->{'copyright'} ? : 0 0 0
46 );
47 }
48 }
49 elsif ( $in_ref->{uri} ) {
50 my $response
51 0 ▶ = LWP::UserAgent->new( %{ $self->{ua_args} || {} } )->get( $in_ref->{uri} );
Condition0%0/2
$self->{'ua_args'} || {}
l!l
00
MC/DC0%0/1
$self->{'ua_args'} || {}
$self->{'ua_args'}
Truth table0%0/2
A
A= $self->{'ua_args'}
Aresult
11
00
52  
53 0 ▶ if ( $response->is_success ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($response->is_success) { } 0 0 0
54 0 ▶ if ( defined $in_ref->{outfile} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $in_ref->{'outfile'}) { } 0 0 0
55 open my $out, '>', $in_ref->{outfile}
56 0 ▶ or $in_ref->{error} = "outfile error [$!]"
Branch: 1 branch
BranchTrueFalseTotal
open my $out, ">", $in_ref->{"outfile"} or $in_ref->{"error"} = "outfile error [$!]" and return 0 0 0
Condition0%0/5
open(my $out, '>', $in_ref->{'outfile'}) || ($in_ref->{'error'} = "outfile error [$!]") && (return)
l!l&&r!l&&!r
000
$in_ref->{"error"} = "outfile error [$!]" and return
!ll
00
MC/DC0%0/2
open(my $out, '>', $in_ref->{'outfile'}) || ($in_ref->{'error'} = "outfile error [$!]") && (return)
open(my $out, '>', $in_ref->{'outfile'}) $in_ref->{"error"} = "outfile error [$!]"
Truth table0%0/3
A || B
A= open(my $out, '>', $in_ref->{'outfile'})B= $in_ref->{"error"} = "outfile error [$!]"
ABresult
1X1
011
000
57 and return;
58  
59 JavaScript::Minifier::minify(
60 input => $response->decoded_content,
61 outfile => $out,
62 ( $in_ref->{stripDebug} ? ( $in_ref->{stripDebug} ) : () ),
63 0 ▶ ( $in_ref->{copyright} ? ( $in_ref->{copyright} ) : () ),
Branch: 2 branches
BranchTrueFalseTotal
$in_ref->{'stripDebug'} ? : 0 0 0
$in_ref->{'copyright'} ? : 0 0 0
64 );
65 }
66 else {
67 $in_ref->{out} = JavaScript::Minifier::minify(
68 input => $response->decoded_content,
69 ( $in_ref->{stripDebug} ? ( $in_ref->{stripDebug} ) : () ),
70 0 ▶ ( $in_ref->{copyright} ? ( $in_ref->{copyright} ) : () ),
Branch: 2 branches
BranchTrueFalseTotal
$in_ref->{'stripDebug'} ? : 0 0 0
$in_ref->{'copyright'} ? : 0 0 0
71 );
72 }
73 }
74 else {
75 0 $in_ref->{error} = $response->status_line;
76 }
77 }
78 else {
79 $in_ref->{out} = JavaScript::Minifier::minify(
80 input => $in_ref->{in},
81 ( $in_ref->{stripDebug} ? ( $in_ref->{stripDebug} ) : () ),
82 0 ▶ ( $in_ref->{copyright} ? ( $in_ref->{copyright} ) : () ),
Branch: 2 branches
BranchTrueFalseTotal
$in_ref->{'stripDebug'} ? : 0 0 0
$in_ref->{'copyright'} ? : 0 0 0
83 );
84 }
85 }
86  
87  
88 2 1;
89 __END__
↑ Summary CSS/Minifier.pm »