| 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
| |||||||||||||||||||||||||||||||||
| 25 | open my $in, '<', $in_ref->{infile} | ||||||||||||||||||||||||||||||||
| 26 | 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 [$!]"
| |||||||||||||||||||||||||||||||||
| 27 | and return; | ||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||
| 29 | 0 | ▶ | if ( defined $in_ref->{outfile} ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 30 | open my $out, '>', $in_ref->{outfile} | ||||||||||||||||||||||||||||||||
| 31 | 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 [$!]"
| |||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||
| 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'} || {}
MC/DC0%0/1
$self->{'ua_args'} || {}
$self->{'ua_args'}
Truth table0%0/2
A
A= $self->{'ua_args'}
| |||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | if ( $response->is_success ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 54 | 0 | ▶ | if ( defined $in_ref->{outfile} ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 55 | open my $out, '>', $in_ref->{outfile} | ||||||||||||||||||||||||||||||||
| 56 | 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 [$!]"
| |||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||
| 83 | ); | ||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||
| 88 | 2 | 1; | |||||||||||||||||||||||||||||||
| 89 | __END__ | ||||||||||||||||||||||||||||||||