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