| 1 | package Kossy::Request; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 8 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 8 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 8 | ▶ | use parent qw/Plack::Request/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 8 | ▶ | use Hash::MultiValue; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 8 | ▶ | use Encode; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 8 | ▶ | use HTTP::Headers::Fast; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 8 | ▶ | use Kossy::Validator; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 8 | ▶ | use HTTP::Entity::Parser; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 8 | ▶ | use WWW::Form::UrlEncoded qw/parse_urlencoded_arrayref build_urlencoded_utf8/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 8 | ▶ | use Cookie::Baker; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 8 | our $VERSION = '0.50'; | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | sub new { | ||||||||||||||||||||||||||||
| 17 | 29 | ▶ | my($class, $env, %opts) = @_; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=12.5
Pod
documented
| |||||||||||||||||||||||||||||
| 18 | 29 | ▶ | Carp::croak(q{$env is required}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $env and ref $env eq "HASH"
MC/DC0%0/2
defined $env and ref $env eq "HASH"
defined $env
ref $env eq "HASH"
Truth table33%1/3
A and B
A= defined $envB= ref $env eq "HASH"
| |||||||||||||||||||||||||||||
| 19 | unless defined $env && ref($env) eq 'HASH'; | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 29 | bless { | |||||||||||||||||||||||||||
| 22 | %opts, | ||||||||||||||||||||||||||||
| 23 | env => $env, | ||||||||||||||||||||||||||||
| 24 | }, $class; | ||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | sub new_response { | ||||||||||||||||||||||||||||
| 28 | 5 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
new_response: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 29 | 5 | require Kossy::Response; | |||||||||||||||||||||||||||
| 30 | 5 | Kossy::Response->new(@_); | |||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | sub cookies { | ||||||||||||||||||||||||||||
| 34 | 7 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
cookies: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 7 | ▶ | return {} unless $self->env->{HTTP_COOKIE}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | # HTTP_COOKIE hasn't changed: reuse the parsed cookie | ||||||||||||||||||||||||||||
| 39 | 6 | ▶ | if ( $self->env->{'plack.cookie.parsed'} | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->env->{"plack.cookie.parsed"} and $self->env->{"plack.cookie.string"} eq $self->env->{"HTTP_COOKIE"}
MC/DC50%1/2
$self->env->{"plack.cookie.parsed"} and $self->env->{"plack.cookie.string"} eq $self->env->{"HTTP_COOKIE"}
$self->env->{"plack.cookie.parsed"}
$self->env->{"plack.cookie.string"} eq $self->env->{"HTTP_COOKIE"}
Truth table66%2/3
A and B
A= $self->env->{"plack.cookie.parsed"}B= $self->env->{"plack.cookie.string"} eq $self->env->{"HTTP_COOKIE"}
| |||||||||||||||||||||||||||||
| 40 | && $self->env->{'plack.cookie.string'} eq $self->env->{HTTP_COOKIE}) { | ||||||||||||||||||||||||||||
| 41 | 4 | return $self->env->{'plack.cookie.parsed'}; | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 2 | $self->env->{'plack.cookie.string'} = $self->env->{HTTP_COOKIE}; | |||||||||||||||||||||||||||
| 45 | 2 | $self->env->{'plack.cookie.parsed'} = crush_cookie($self->env->{'plack.cookie.string'}); | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | sub request_body_parser { | ||||||||||||||||||||||||||||
| 50 | 7 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
request_body_parser: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 51 | 7 | ▶ | unless (exists $self->{request_body_parser}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 52 | 7 | $self->{request_body_parser} = $self->_build_request_body_parser(); | |||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | 7 | return $self->{request_body_parser}; | |||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 8 | my $default_parser = HTTP::Entity::Parser->new(); | |||||||||||||||||||||||||||
| 58 | 8 | $default_parser->register( | |||||||||||||||||||||||||||
| 59 | 'application/x-www-form-urlencoded', | ||||||||||||||||||||||||||||
| 60 | 'HTTP::Entity::Parser::UrlEncoded' | ||||||||||||||||||||||||||||
| 61 | ); | ||||||||||||||||||||||||||||
| 62 | 8 | $default_parser->register( | |||||||||||||||||||||||||||
| 63 | 'multipart/form-data', | ||||||||||||||||||||||||||||
| 64 | 'HTTP::Entity::Parser::MultiPart' | ||||||||||||||||||||||||||||
| 65 | ); | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 8 | my $json_parser = HTTP::Entity::Parser->new(); | |||||||||||||||||||||||||||
| 68 | 8 | $json_parser->register( | |||||||||||||||||||||||||||
| 69 | 'application/x-www-form-urlencoded', | ||||||||||||||||||||||||||||
| 70 | 'HTTP::Entity::Parser::UrlEncoded' | ||||||||||||||||||||||||||||
| 71 | ); | ||||||||||||||||||||||||||||
| 72 | 8 | $json_parser->register( | |||||||||||||||||||||||||||
| 73 | 'multipart/form-data', | ||||||||||||||||||||||||||||
| 74 | 'HTTP::Entity::Parser::MultiPart' | ||||||||||||||||||||||||||||
| 75 | ); | ||||||||||||||||||||||||||||
| 76 | 8 | $json_parser->register( | |||||||||||||||||||||||||||
| 77 | 'application/json', | ||||||||||||||||||||||||||||
| 78 | 'HTTP::Entity::Parser::JSON' | ||||||||||||||||||||||||||||
| 79 | ); | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | sub _build_request_body_parser { | ||||||||||||||||||||||||||||
| 82 | 7 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_build_request_body_parser: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 83 | 7 | ▶ | if ( $self->env->{'kossy.request.parse_json_body'} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 84 | 5 | return $json_parser; | |||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||
| 86 | 2 | $default_parser; | |||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | sub _parse_request_body { | ||||||||||||||||||||||||||||
| 90 | 11 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_parse_request_body: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 91 | 11 | ▶ | if ( !$self->env->{CONTENT_TYPE} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 92 | 4 | $self->env->{'kossy.request.body_parameters'} = []; | |||||||||||||||||||||||||||
| 93 | 4 | $self->env->{'plack.request.upload'} = Hash::MultiValue->new(); | |||||||||||||||||||||||||||
| 94 | 4 | return; | |||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | 7 | my ($params,$uploads) = $self->request_body_parser->parse($self->env); | |||||||||||||||||||||||||||
| 98 | 7 | $self->env->{'kossy.request.body_parameters'} = $params; | |||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 7 | my $upload_hmv = Hash::MultiValue->new(); | |||||||||||||||||||||||||||
| 101 | 7 | ▶ | while ( my ($k,$v) = splice @$uploads, 0, 2 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 102 | 1 | my %copy = %$v; | |||||||||||||||||||||||||||
| 103 | 1 | $copy{headers} = HTTP::Headers::Fast->new(@{$v->{headers}}); | |||||||||||||||||||||||||||
| 104 | 1 | $upload_hmv->add($k, Plack::Request::Upload->new(%copy)); | |||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||
| 106 | 7 | $self->env->{'plack.request.upload'} = $upload_hmv; | |||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | sub uploads { | ||||||||||||||||||||||||||||
| 110 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
uploads: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||
| 111 | 4 | ▶ | unless ($self->env->{'plack.request.upload'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 112 | 0 | $self->_parse_request_body; | |||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||
| 114 | 4 | $self->env->{'plack.request.upload'}; | |||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | sub body_parameters { | ||||||||||||||||||||||||||||
| 118 | 12 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
body_parameters: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 119 | $self->env->{'kossy.request.body'} ||= | ||||||||||||||||||||||||||||
| 120 | 12 | ▶ | Hash::MultiValue->new(map { Encode::decode_utf8($_) } @{$self->_body_parameters()}); | ||||||||||||||||||||||||||
|
Condition66%2/3
$self->env->{"kossy.request.body"} ||= "Hash::MultiValue"->new(map({&Encode::decode_utf8($_);} @{$self->_body_parameters;}))
MC/DC0%0/2
$self->env->{"kossy.request.body"} ||= "Hash::MultiValue"->new(map({&Encode::decode_utf8($_);} @{$self->_body_parameters;}))
$self->env->{"kossy.request.body"}
"Hash::MultiValue"->new(map({&Encode::decode_utf8($_);} @{$self->_body_parameters;}))
Truth table66%2/3
A ||= B
A= $self->env->{"kossy.request.body"}B= "Hash::MultiValue"->new(map({&Encode::decode_utf8($_);} @{$self->_body_parameters;}))
| |||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | sub query_parameters { | ||||||||||||||||||||||||||||
| 124 | 13 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
query_parameters: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 125 | $self->env->{'kossy.request.query'} ||= | ||||||||||||||||||||||||||||
| 126 | 13 | ▶ | Hash::MultiValue->new(map { Encode::decode_utf8($_) } @{$self->_query_parameters()}); | ||||||||||||||||||||||||||
|
Condition66%2/3
$self->env->{"kossy.request.query"} ||= "Hash::MultiValue"->new(map({&Encode::decode_utf8($_);} @{$self->_query_parameters;}))
MC/DC0%0/2
$self->env->{"kossy.request.query"} ||= "Hash::MultiValue"->new(map({&Encode::decode_utf8($_);} @{$self->_query_parameters;}))
$self->env->{"kossy.request.query"}
"Hash::MultiValue"->new(map({&Encode::decode_utf8($_);} @{$self->_query_parameters;}))
Truth table66%2/3
A ||= B
A= $self->env->{"kossy.request.query"}B= "Hash::MultiValue"->new(map({&Encode::decode_utf8($_);} @{$self->_query_parameters;}))
| |||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | sub parameters { | ||||||||||||||||||||||||||||
| 130 | 19 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
parameters: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 131 | 19 | ▶ | $self->env->{'kossy.request.merged'} ||= do { | ||||||||||||||||||||||||||
|
Condition66%2/3
$self->env->{"kossy.request.merged"} ||= do {
"Hash::MultiValue"->new($self->query_parameters->flatten, $self->body_parameters->flatten)
}
MC/DC0%0/2
$self->env->{"kossy.request.merged"} ||= do {
"Hash::MultiValue"->new($self->query_parameters->flatten, $self->body_parameters->flatten)
}
$self->env->{"kossy.request.merged"}
do {
"Hash::MultiValue"->new($self->query_parameters->flatten, $self->body_parameters->flatten)
}
Truth table66%2/3
A ||= B
A= $self->env->{"kossy.request.merged"}B= do {
"Hash::MultiValue"->new($self->query_parameters->flatten, $self->body_parameters->flatten)
}
| |||||||||||||||||||||||||||||
| 132 | 11 | Hash::MultiValue->new( | |||||||||||||||||||||||||||
| 133 | $self->query_parameters->flatten, | ||||||||||||||||||||||||||||
| 134 | $self->body_parameters->flatten, | ||||||||||||||||||||||||||||
| 135 | ); | ||||||||||||||||||||||||||||
| 136 | }; | ||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | sub _body_parameters { | ||||||||||||||||||||||||||||
| 140 | 11 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_body_parameters: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 141 | 11 | ▶ | unless ($self->env->{'kossy.request.body_parameters'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 142 | 10 | $self->_parse_request_body; | |||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||
| 144 | 11 | return $self->env->{'kossy.request.body_parameters'}; | |||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||
| 146 | sub _query_parameters { | ||||||||||||||||||||||||||||
| 147 | 11 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_query_parameters: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 148 | 11 | ▶ | unless ( $self->env->{'kossy.request.query_parameters'} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 149 | $self->env->{'kossy.request.query_parameters'} = | ||||||||||||||||||||||||||||
| 150 | 11 | parse_urlencoded_arrayref($self->env->{'QUERY_STRING'}); | |||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||
| 152 | 11 | return $self->env->{'kossy.request.query_parameters'}; | |||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | sub body_parameters_raw { | ||||||||||||||||||||||||||||
| 156 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
body_parameters_raw: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 157 | 0 | ▶ | unless ($self->env->{'plack.request.body'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 158 | 0 | $self->env->{'plack.request.body'} = Hash::MultiValue->new(@{$self->_body_parameters}); | |||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||
| 160 | 0 | return $self->env->{'plack.request.body'}; | |||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | sub query_parameters_raw { | ||||||||||||||||||||||||||||
| 164 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
query_parameters_raw: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 165 | 0 | ▶ | unless ($self->env->{'plack.request.query'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 166 | 0 | $self->env->{'plack.request.query'} = Hash::MultiValue->new(@{$self->_query_parameters}); | |||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||
| 168 | 0 | return $self->env->{'plack.request.query'}; | |||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | sub parameters_raw { | ||||||||||||||||||||||||||||
| 172 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
parameters_raw: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 173 | 0 | ▶ | $self->env->{'plack.request.merged'} ||= do { | ||||||||||||||||||||||||||
|
Condition0%0/3
$self->env->{"plack.request.merged"} ||= do {
"Hash::MultiValue"->new(@{$self->_query_parameters;}, @{$self->_body_parameters;})
}
MC/DC0%0/2
$self->env->{"plack.request.merged"} ||= do {
"Hash::MultiValue"->new(@{$self->_query_parameters;}, @{$self->_body_parameters;})
}
$self->env->{"plack.request.merged"}
do {
"Hash::MultiValue"->new(@{$self->_query_parameters;}, @{$self->_body_parameters;})
}
Truth table0%0/3
A ||= B
A= $self->env->{"plack.request.merged"}B= do {
"Hash::MultiValue"->new(@{$self->_query_parameters;}, @{$self->_body_parameters;})
}
| |||||||||||||||||||||||||||||
| 174 | Hash::MultiValue->new( | ||||||||||||||||||||||||||||
| 175 | 0 | @{$self->_query_parameters}, | |||||||||||||||||||||||||||
| 176 | 0 | @{$self->_body_parameters} | |||||||||||||||||||||||||||
| 177 | ); | ||||||||||||||||||||||||||||
| 178 | }; | ||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | sub param_raw { | ||||||||||||||||||||||||||||
| 182 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
param_raw: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | 0 | ▶ | return keys %{ $self->parameters_raw } if @_ == 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | 0 | my $key = shift; | |||||||||||||||||||||||||||
| 187 | 0 | ▶ | return $self->parameters_raw->{$key} unless wantarray; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 188 | 0 | return $self->parameters_raw->get_all($key); | |||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||
| 191 | sub base { | ||||||||||||||||||||||||||||
| 192 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
base: called CC=3 SCAR=11.8
Pod
documented
| |||||||||||||||||||||||||||||
| 193 | 4 | ▶ | $self->{_base} ||= {}; | ||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"_base"} ||= {}
MC/DC0%0/1
$self->{"_base"} ||= {}
$self->{"_base"}
Truth table50%1/2
A
A= $self->{"_base"}
| |||||||||||||||||||||||||||||
| 194 | 4 | my $base = $self->_uri_base; | |||||||||||||||||||||||||||
| 195 | 4 | ▶ | $self->{_base}->{$base} ||= $self->SUPER::base; | ||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"_base"}{$base} ||= $self->SUPER::base
MC/DC0%0/2
$self->{"_base"}{$base} ||= $self->SUPER::base
$self->{"_base"}{$base}
$self->SUPER::base
Truth table33%1/3
A ||= B
A= $self->{"_base"}{$base}B= $self->SUPER::base
| |||||||||||||||||||||||||||||
| 196 | 4 | $self->{_base}->{$base}->clone; | |||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | sub uri_for { | ||||||||||||||||||||||||||||
| 200 | 4 | ▶ | my($self, $path, $args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
uri_for: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 201 | 4 | my $uri = $self->base; | |||||||||||||||||||||||||||
| 202 | 4 | ▶ | my $base = $uri->path eq "/" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 203 | ? "" | ||||||||||||||||||||||||||||
| 204 | : $uri->path; | ||||||||||||||||||||||||||||
| 205 | 4 | my $query = ''; | |||||||||||||||||||||||||||
| 206 | 4 | ▶ | if ( $args ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 207 | 2 | $query = build_urlencoded_utf8($args); | |||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||
| 209 | 4 | ▶ | $uri->path_query( $base . $path . (length $query ? "?$query" : "")); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 210 | 4 | $uri; | |||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | sub validator { | ||||||||||||||||||||||||||||
| 214 | 0 | ▶ | my ($self, $rule) = @_; | ||||||||||||||||||||||||||
|
Subroutine
validator: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 215 | 0 | Kossy::Validator->check($self,$rule); | |||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | 8 | 1; | |||||||||||||||||||||||||||