line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Apache::AxKit::Plugin::Param::Expr; |
2
|
1
|
|
|
1
|
|
6331
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
53
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = 0.2; |
5
|
1
|
|
|
1
|
|
1422
|
use Apache::Constants qw(OK); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Apache::Request; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub handler { |
9
|
|
|
|
|
|
|
my $r = shift; |
10
|
|
|
|
|
|
|
my @param = $r->dir_config->get('AxParamExpr'); |
11
|
|
|
|
|
|
|
$r->pnotes('INPUT',{}) unless $r->pnotes('INPUT'); |
12
|
|
|
|
|
|
|
my $apr = Apache::Request->instance($r); |
13
|
|
|
|
|
|
|
while (@param > 1) { |
14
|
|
|
|
|
|
|
my $val = eval($param[-1]); |
15
|
|
|
|
|
|
|
AxKit::Debug(5,"param '$param[-2]': ($param[-1]) = $val"); |
16
|
|
|
|
|
|
|
throw Apache::AxKit::Exception::Error(-text => "AxParamExpr '$param[-2]': $@") if $@; |
17
|
|
|
|
|
|
|
$val = '' if !defined $val; |
18
|
|
|
|
|
|
|
$r->pnotes('INPUT')->{$param[-2]} = $val; |
19
|
|
|
|
|
|
|
$apr->param($param[-2],$val); |
20
|
|
|
|
|
|
|
pop @param; |
21
|
|
|
|
|
|
|
pop @param; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
my $key = ''; |
24
|
|
|
|
|
|
|
@param = $r->dir_config->get('AxCacheParamExpr'); |
25
|
|
|
|
|
|
|
while (@param > 1) { |
26
|
|
|
|
|
|
|
my $val = eval($param[-1]); |
27
|
|
|
|
|
|
|
AxKit::Debug(5,"param '$param[-2]': ($param[-1]) = $val"); |
28
|
|
|
|
|
|
|
throw Apache::AxKit::Exception::Error(-text => "AxCacheParamExpr '$param[-2]': $@") if $@; |
29
|
|
|
|
|
|
|
$val = '' if !defined $val; |
30
|
|
|
|
|
|
|
$r->pnotes('INPUT')->{$param[-2]} = $val; |
31
|
|
|
|
|
|
|
$apr->param($param[-2],$val); |
32
|
|
|
|
|
|
|
$key .= '|'.$val; |
33
|
|
|
|
|
|
|
pop @param; |
34
|
|
|
|
|
|
|
pop @param; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
@param = $r->dir_config->get('AxCacheExpr'); |
37
|
|
|
|
|
|
|
while (@param) { |
38
|
|
|
|
|
|
|
my $val = $r->pnotes('INPUT')->{$param[0]}; |
39
|
|
|
|
|
|
|
AxKit::Debug(5,"param '$param[0]': () = $val"); |
40
|
|
|
|
|
|
|
throw Apache::AxKit::Exception::Error(-text => "AxCacheExpr '$param[0]': $@") if $@; |
41
|
|
|
|
|
|
|
$val = '' if !defined $val; |
42
|
|
|
|
|
|
|
$key .= '|'.$val; |
43
|
|
|
|
|
|
|
shift @param; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
$r->notes('axkit_cache_extra', $r->notes('axkit_cache_extra') . $key); |
46
|
|
|
|
|
|
|
return OK; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
__END__ |