line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
400121
|
use 5.16.0; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
56
|
|
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
47
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
55
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Dancer2::Plugin::ParamKeywords; |
6
|
1
|
|
|
1
|
|
563
|
use Dancer2::Plugin; |
|
1
|
|
|
|
|
2817
|
|
|
1
|
|
|
|
|
8
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = 'v0.1.2'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
foreach my $source ( qw( route query body ) ) { |
11
|
|
|
|
|
|
|
register "$source\_param" => sub { |
12
|
3
|
|
|
3
|
|
173044
|
my ($dsl, $param) = @_; |
13
|
3
|
|
|
|
|
45
|
$dsl->app->request->params($source)->{$param}; |
14
|
|
|
|
|
|
|
}; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
register "$source\_params" => sub { |
17
|
3
|
|
|
3
|
|
12188
|
my $dsl = shift; |
18
|
3
|
|
|
|
|
23
|
$dsl->app->request->params($source); |
19
|
|
|
|
|
|
|
}; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
register munged_params => sub { |
23
|
3
|
|
|
3
|
|
35319
|
my $dsl = shift; |
24
|
3
|
|
|
|
|
18
|
my $conf = plugin_setting->{munge_precedence}; |
25
|
3
|
50
|
|
|
|
329
|
die 'Please configure the plugin settings for ParamKeywords to use munged_params' |
26
|
|
|
|
|
|
|
unless ref($conf) eq 'ARRAY'; |
27
|
|
|
|
|
|
|
|
28
|
3
|
|
|
|
|
9
|
my %params = map { $dsl->app->request->params($_) } reverse @$conf; |
|
9
|
|
|
|
|
114
|
|
29
|
3
|
50
|
|
|
|
54
|
wantarray ? %params : \%params; |
30
|
|
|
|
|
|
|
}; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
register munged_param => sub { |
33
|
3
|
|
|
3
|
|
36101
|
my ($dsl, $param) = @_; |
34
|
3
|
|
|
|
|
26
|
my $conf = plugin_setting->{munge_precedence}; |
35
|
3
|
50
|
|
|
|
303
|
die 'Please configure the plugin settings for ParamKeywords to use munged_param' |
36
|
|
|
|
|
|
|
unless ref($conf) eq 'ARRAY'; |
37
|
|
|
|
|
|
|
|
38
|
3
|
|
|
|
|
11
|
my %params = map { $dsl->app->request->params($_) } reverse @$conf; |
|
9
|
|
|
|
|
118
|
|
39
|
3
|
|
|
|
|
50
|
$params{$param}; |
40
|
|
|
|
|
|
|
}; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
register_plugin for_versions => [ 2 ] ; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# ABSTRACT: Sugar for the params() keyword |
47
|
|
|
|
|
|
|
# PODNAME: Dancer2::Plugin::ParamKeywords |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |