line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::ParamExpand; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
4170
|
use Mojo::Base 'Mojolicious::Plugin'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
17
|
|
4
|
2
|
|
|
2
|
|
2338
|
use CGI::Expand; |
|
2
|
|
|
|
|
2950
|
|
|
2
|
|
|
|
|
12
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub register |
9
|
|
|
|
|
|
|
{ |
10
|
3
|
|
|
3
|
1
|
19668
|
my ($self, $app, $config) = @_; |
11
|
3
|
|
|
|
|
9
|
my $class = 'Mojolicious::Plugin::ParamExpand::expander'; |
12
|
|
|
|
|
|
|
|
13
|
3
|
|
|
|
|
11
|
_make_package($class, $config); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
$app->hook(before_dispatch => sub { |
16
|
7
|
|
|
7
|
|
162153
|
my $c = shift; |
17
|
7
|
|
|
|
|
18
|
my $hash; |
18
|
|
|
|
|
|
|
|
19
|
7
|
|
|
|
|
17
|
eval { $hash = $class->expand_hash($c->req->params->to_hash) }; |
|
7
|
|
|
|
|
46
|
|
20
|
7
|
100
|
|
|
|
4378
|
if($@) { |
21
|
1
|
|
|
|
|
14
|
$c->render_exception($@); |
22
|
1
|
|
|
|
|
6210
|
return; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
6
|
|
|
|
|
54
|
$c->param($_ => $hash->{$_}) for keys %$hash; |
26
|
3
|
|
|
|
|
38
|
}); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub _make_package |
30
|
|
|
|
|
|
|
{ |
31
|
2
|
|
|
2
|
|
519
|
no strict 'refs'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
341
|
|
32
|
|
|
|
|
|
|
|
33
|
3
|
|
|
3
|
|
5
|
my ($class, $config) = @_; |
34
|
3
|
|
|
|
|
6
|
@{"${class}::ISA"} = 'CGI::Expand'; |
|
3
|
|
|
|
|
74
|
|
35
|
|
|
|
|
|
|
|
36
|
3
|
|
|
|
|
10
|
for(qw|max_array separator|) { |
37
|
6
|
|
|
|
|
13
|
my $val = $config->{$_}; |
38
|
6
|
100
|
|
16
|
|
32
|
*{"${class}::$_"} = sub { $val } if defined $val; |
|
2
|
|
|
|
|
18
|
|
|
16
|
|
|
|
|
3740
|
|
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |