| 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
| |||||||||||||||||||||||||||||||||
| 26 | open my $in, '<', $in_ref->{infile} | ||||||||||||||||||||||||||||||||
| 27 | 0 | ▶ | or $in_ref->{error} = "infile error [$!]" | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
open(my $in, '<', $in_ref->{'infile'}) || ($in_ref->{'error'} = "infile error [$!]") && (return)
$in_ref->{"error"} = "infile error [$!]" and return
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 [$!]"
| |||||||||||||||||||||||||||||||||
| 28 | and return; | ||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | if ( defined $in_ref->{outfile} ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 32 | open my $out, '>', $in_ref->{outfile} | ||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | or $in_ref->{error} = "outfile error [$!]" | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
open(my $out, '>', $in_ref->{'outfile'}) || ($in_ref->{'error'} = "outfile error [$!]") && (return)
$in_ref->{"error"} = "outfile error [$!]" and return
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 [$!]"
| |||||||||||||||||||||||||||||||||
| 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'} || {}
MC/DC0%0/1
$self->{'ua_args'} || {}
$self->{'ua_args'}
Truth table0%0/2
A
A= $self->{'ua_args'}
| |||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | if ( $response->is_success ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | if ( defined $in_ref->{outfile} ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 48 | open my $out, '>', $in_ref->{outfile} | ||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | or $in_ref->{error} = "outfile error [$!]" | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
open(my $out, '>', $in_ref->{'outfile'}) || ($in_ref->{'error'} = "outfile error [$!]") && (return)
$in_ref->{"error"} = "outfile error [$!]" and return
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 [$!]"
| |||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||
| 72 | 2 | 1; | |||||||||||||||||||||||||||||||
| 73 | __END__ | ||||||||||||||||||||||||||||||||