CSS/Minifier.pm

filter: Statementstmt 50.0% 20 / 40 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 17 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 66.6% 6 / 9 Podpod 100% 1 / 1 totaltotal 29.3% 27 / 92 CC 14 SCAR 49.0
CC
14
Cov
27%
_process_request
210.0
_methods_define
2.0
minify
2.0
CRAP 134.1
« JavaScript/Minifier.pm ↑ Summary WebService/Validator/HTML/W3C.pm »
1 package POE::Component::CSS::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 CSS::Minifier;
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=14 SCAR=53.5
22 0 my ( $self, $in_ref ) = @_;
23  
24 0 eval {
25 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
26 open my $in, '<', $in_ref->{infile}
27 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
28 and return;
29  
30  
31 0 ▶ if ( defined $in_ref->{outfile} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $in_ref->{'outfile'}) { } 0 0 0
32 open my $out, '>', $in_ref->{outfile}
33 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
34 and return;
35  
36 0 CSS::Minifier::minify( input => $in, outfile => $out );
37 }
38 else {
39 0 $in_ref->{out} = CSS::Minifier::minify( input => $in );
40 }
41 }
42 elsif ( $in_ref->{uri} ) {
43 my $response
44 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
45  
46 0 ▶ if ( $response->is_success ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($response->is_success) { } 0 0 0
47 0 ▶ if ( defined $in_ref->{outfile} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $in_ref->{'outfile'}) { } 0 0 0
48 open my $out, '>', $in_ref->{outfile}
49 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
50 and return;
51  
52 0 CSS::Minifier::minify(
53 input => $response->decoded_content,
54 outfile => $out,
55 );
56 }
57 else {
58 0 $in_ref->{out} = CSS::Minifier::minify( input => $response->decoded_content );
59 }
60 }
61 else {
62 0 $in_ref->{error} = $response->status_line;
63 }
64 }
65 else {
66 0 $in_ref->{out} = CSS::Minifier::minify( input => $in_ref->{in} );
67 }
68 };
69 0 ▶ $@ and $in_ref->{out} = "ERROR: $@";
Branch: 1 branch
BranchTrueFalseTotal
$@ and $in_ref->{"out"} = "ERROR: $@" 0 0 0
70 }
71  
72 2 1;
73 __END__
« JavaScript/Minifier.pm ↑ Summary WebService/Validator/HTML/W3C.pm »