| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Web::Dispatcher::Simple::Request; |
|
2
|
3
|
|
|
3
|
|
13
|
use strict; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
110
|
|
|
3
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
68
|
|
|
4
|
3
|
|
|
3
|
|
21
|
use base qw/Plack::Request/; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
2706
|
|
|
5
|
3
|
|
|
3
|
|
195030
|
use Web::Dispatcher::Simple::Response; |
|
|
3
|
|
|
|
|
14
|
|
|
|
3
|
|
|
|
|
194
|
|
|
6
|
3
|
|
|
3
|
|
26
|
use Encode; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
349
|
|
|
7
|
3
|
|
|
3
|
|
18
|
use Hash::MultiValue; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
1192
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new_response { |
|
10
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
11
|
0
|
|
|
|
|
|
Web::Dispatcher::Simple::Response->new(@_); |
|
12
|
|
|
|
|
|
|
} |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub uri_for { |
|
15
|
0
|
|
|
0
|
0
|
|
my ( $self, $path, $args ) = @_; |
|
16
|
0
|
|
|
|
|
|
my $uri = $self->base; |
|
17
|
0
|
|
|
|
|
|
$uri->path($path); |
|
18
|
0
|
0
|
|
|
|
|
$uri->query_form(@$args) if $args; |
|
19
|
0
|
|
|
|
|
|
$uri; |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub decode_params { |
|
23
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
24
|
0
|
|
0
|
|
|
|
$self->env->{'plack.request.query'} ||= _decode_multivalue( |
|
25
|
|
|
|
|
|
|
Hash::MultiValue->new( $self->uri->query_form ) ); |
|
26
|
0
|
0
|
|
|
|
|
unless ( $self->env->{'plack.request.body'} ) { |
|
27
|
0
|
|
|
|
|
|
$self->_parse_request_body; |
|
28
|
0
|
|
|
|
|
|
$self->env->{'plack.request.body'} |
|
29
|
|
|
|
|
|
|
= _decode_multivalue( $self->env->{'plack.request.body'} ); |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _decode_multivalue { |
|
34
|
0
|
|
|
0
|
|
|
my $hash = shift; |
|
35
|
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
my $params = $hash->mixed; |
|
37
|
0
|
|
|
|
|
|
my $decoded_params = {}; |
|
38
|
0
|
|
|
|
|
|
while ( my ( $k, $v ) = each %$params ) { |
|
39
|
0
|
0
|
|
|
|
|
$decoded_params->{ Encode::decode_utf8($k) } |
|
40
|
|
|
|
|
|
|
= ref $v eq 'ARRAY' |
|
41
|
|
|
|
|
|
|
? [ map Encode::decode_utf8($_), @$v ] |
|
42
|
|
|
|
|
|
|
: Encode::decode_utf8($v); |
|
43
|
|
|
|
|
|
|
} |
|
44
|
0
|
|
|
|
|
|
return Hash::MultiValue->from_mixed(%$decoded_params); |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |