line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::Parametry::ParamerHelpers; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
34
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
5
|
1
|
|
|
1
|
|
5
|
use Mojo::Collection; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
442
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '1.001001'; # VERSION |
8
|
|
|
|
|
|
|
|
9
|
16
|
|
|
16
|
0
|
113
|
sub new { bless { _c => $_[1] }, $_[0] } |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub matching { |
12
|
16
|
|
|
16
|
0
|
60
|
my ($self, $re, %args) = @_; |
13
|
16
|
|
|
|
|
44
|
my $c = $self->{_c}; |
14
|
|
|
|
|
|
|
|
15
|
16
|
100
|
|
|
|
128
|
$re = qr/^\Q$re\E/ unless ref $re eq 'Regexp'; |
16
|
16
|
|
|
|
|
65
|
my $params = Mojo::Collection->new(grep /$re/, $c->req->params->names->@*); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
16
|
100
|
|
|
|
5188
|
if ($args{as_hash}) { |
20
|
|
|
|
|
|
|
return +{ $params->map(sub { |
21
|
8
|
|
|
8
|
|
482
|
my $orig_name = $_; |
22
|
8
|
50
|
|
|
|
32
|
$args{subst} and s/$re/$args{subst}/; |
23
|
8
|
100
|
|
|
|
47
|
$args{strip} and s/$re//; |
24
|
8
|
|
|
|
|
29
|
$_ => $c->param($orig_name) |
25
|
4
|
|
|
|
|
38
|
})->each } |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
$args{vals} |
29
|
12
|
100
|
|
8
|
|
65
|
and return $params->map(sub {$c->param($_)}); |
|
8
|
|
|
|
|
550
|
|
30
|
|
|
|
|
|
|
|
31
|
8
|
50
|
|
0
|
|
23
|
$args{subst} and $params = $params->map(sub {s/$re/$args{subst}/r}); |
|
0
|
|
|
|
|
0
|
|
32
|
8
|
100
|
|
4
|
|
32
|
$args{strip} and $params = $params->map(sub {s/$re//r}); |
|
4
|
|
|
|
|
46
|
|
33
|
8
|
|
|
|
|
79
|
$params |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__ |