line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package POE::Component::JavaScript::Minifier; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
283984
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
36
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '1.001004'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
4
|
use POE; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
9
|
1
|
|
|
1
|
|
297
|
use base 'POE::Component::NonBlockingWrapper::Base'; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
86
|
|
10
|
1
|
|
|
1
|
|
10
|
use JavaScript::Minifier 1.10 (); |
|
1
|
|
|
|
|
24
|
|
|
1
|
|
|
|
|
14
|
|
11
|
1
|
|
|
1
|
|
4
|
use LWP::UserAgent; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
474
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub _methods_define { |
14
|
0
|
|
|
0
|
|
|
return ( minify => '_wheel_entry' ); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub minify { |
18
|
0
|
|
|
0
|
1
|
|
$poe_kernel->post( shift->{session_id} => minify => @_ ); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub _process_request { |
22
|
0
|
|
|
0
|
|
|
my ( $self, $in_ref ) = @_; |
23
|
|
|
|
|
|
|
|
24
|
0
|
0
|
|
|
|
|
if ( defined $in_ref->{infile} ) { |
|
|
0
|
|
|
|
|
|
25
|
0
|
0
|
0
|
|
|
|
open my $in, '<', $in_ref->{infile} |
26
|
|
|
|
|
|
|
or $in_ref->{error} = "infile error [$!]" |
27
|
|
|
|
|
|
|
and return; |
28
|
|
|
|
|
|
|
|
29
|
0
|
0
|
|
|
|
|
if ( defined $in_ref->{outfile} ) { |
30
|
0
|
0
|
0
|
|
|
|
open my $out, '>', $in_ref->{outfile} |
31
|
|
|
|
|
|
|
or $in_ref->{error} = "outfile error [$!]" |
32
|
|
|
|
|
|
|
and return; |
33
|
|
|
|
|
|
|
|
34
|
0
|
0
|
|
|
|
|
JavaScript::Minifier::minify( |
|
|
0
|
|
|
|
|
|
35
|
|
|
|
|
|
|
input => $in, |
36
|
|
|
|
|
|
|
outfile => $out, |
37
|
|
|
|
|
|
|
( $in_ref->{stripDebug} ? ( $in_ref->{stripDebug} ) : () ), |
38
|
|
|
|
|
|
|
( $in_ref->{copyright} ? ( $in_ref->{copyright} ) : () ), |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
else { |
42
|
0
|
0
|
|
|
|
|
$in_ref->{out} = JavaScript::Minifier::minify( |
|
|
0
|
|
|
|
|
|
43
|
|
|
|
|
|
|
input => $in, |
44
|
|
|
|
|
|
|
( $in_ref->{stripDebug} ? ( $in_ref->{stripDebug} ) : () ), |
45
|
|
|
|
|
|
|
( $in_ref->{copyright} ? ( $in_ref->{copyright} ) : () ), |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
elsif ( $in_ref->{uri} ) { |
50
|
0
|
0
|
|
|
|
|
my $response |
51
|
0
|
|
|
|
|
|
= LWP::UserAgent->new( %{ $self->{ua_args} || {} } )->get( $in_ref->{uri} ); |
52
|
|
|
|
|
|
|
|
53
|
0
|
0
|
|
|
|
|
if ( $response->is_success ) { |
54
|
0
|
0
|
|
|
|
|
if ( defined $in_ref->{outfile} ) { |
55
|
0
|
0
|
0
|
|
|
|
open my $out, '>', $in_ref->{outfile} |
56
|
|
|
|
|
|
|
or $in_ref->{error} = "outfile error [$!]" |
57
|
|
|
|
|
|
|
and return; |
58
|
|
|
|
|
|
|
|
59
|
0
|
0
|
|
|
|
|
JavaScript::Minifier::minify( |
|
|
0
|
|
|
|
|
|
60
|
|
|
|
|
|
|
input => $response->decoded_content, |
61
|
|
|
|
|
|
|
outfile => $out, |
62
|
|
|
|
|
|
|
( $in_ref->{stripDebug} ? ( $in_ref->{stripDebug} ) : () ), |
63
|
|
|
|
|
|
|
( $in_ref->{copyright} ? ( $in_ref->{copyright} ) : () ), |
64
|
|
|
|
|
|
|
); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
else { |
67
|
0
|
0
|
|
|
|
|
$in_ref->{out} = JavaScript::Minifier::minify( |
|
|
0
|
|
|
|
|
|
68
|
|
|
|
|
|
|
input => $response->decoded_content, |
69
|
|
|
|
|
|
|
( $in_ref->{stripDebug} ? ( $in_ref->{stripDebug} ) : () ), |
70
|
|
|
|
|
|
|
( $in_ref->{copyright} ? ( $in_ref->{copyright} ) : () ), |
71
|
|
|
|
|
|
|
); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
else { |
75
|
0
|
|
|
|
|
|
$in_ref->{error} = $response->status_line; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
else { |
79
|
0
|
0
|
|
|
|
|
$in_ref->{out} = JavaScript::Minifier::minify( |
|
|
0
|
|
|
|
|
|
80
|
|
|
|
|
|
|
input => $in_ref->{in}, |
81
|
|
|
|
|
|
|
( $in_ref->{stripDebug} ? ( $in_ref->{stripDebug} ) : () ), |
82
|
|
|
|
|
|
|
( $in_ref->{copyright} ? ( $in_ref->{copyright} ) : () ), |
83
|
|
|
|
|
|
|
); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |
89
|
|
|
|
|
|
|
__END__ |