line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Apache2::Filter::CSS::LESS; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
839
|
use 5.008; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
34
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
446
|
use APR::Table; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Apache2::Const -compile => qw(OK); |
8
|
|
|
|
|
|
|
use Apache2::Filter; |
9
|
|
|
|
|
|
|
use Apache2::Log; |
10
|
|
|
|
|
|
|
use Apache2::RequestRec; |
11
|
|
|
|
|
|
|
use Apache2::RequestUtil; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use CSS::LESSp; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.30'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub handler :method { |
18
|
|
|
|
|
|
|
my ($class, $f) = @_; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my $r = $f->r; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my $ctx = $f->ctx; |
23
|
|
|
|
|
|
|
while ($f->read(my $buffer, 4096)) { |
24
|
|
|
|
|
|
|
$ctx .= $buffer; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
unless ($f->seen_eos) { |
28
|
|
|
|
|
|
|
$f->ctx($ctx); |
29
|
|
|
|
|
|
|
return Apache2::Const::OK; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
if ($ctx) { |
33
|
|
|
|
|
|
|
my $css = join '', CSS::LESSp->parse($ctx); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# fix headers, change content type |
36
|
|
|
|
|
|
|
$r->headers_out->unset('Content-Length'); |
37
|
|
|
|
|
|
|
$r->content_type($r->dir_config('LessContentType') || 'text/css'); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
$f->print($css); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
return Apache2::Const::OK; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |