| 1 | package YATT::Lite::WebMVC0::Connection; sub PROP () {__PACKAGE__} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 71 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 71 | ▶ | use warnings qw(FATAL all NONFATAL misc); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 71 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 71 | ▶ | use base qw(YATT::Lite::Connection); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | use YATT::Lite::MFields | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 71 | ▶ | (qw/cgi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | is_psgi hmv | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | site_prefix | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | no_nested_query | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | mkquery_with_body_params | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | no_unicode_params | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | _dir_config_cache | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | _site_config_is_examined | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | _sigil_type_item | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | _current_user | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | _htdebug_cache | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 71 | /); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 71 | ▶ | use YATT::Lite::Util qw(globref url_encode nonempty empty rootname lexpand); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 71 | ▶ | use YATT::Lite::PSGIEnv; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 71 | ▶ | use YATT::Lite::Util::CGICompat; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | #---------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 71 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=5 SCAR=19.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | # print STDERR join("\n", sort(keys our %FIELDS)), "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 71 | foreach my $name (qw(raw_body uploads upload)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 213 | ▶ | *{globref(PROP, $name)} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 4 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 4 | ▶ | unless ($prop->{is_psgi}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | croak "Connection method $name is PSGI mode only!" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 4 | $prop->{cgi}->$name(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 213 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 71 | foreach my $name (qw(url_param)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 71 | ▶ | *{globref(PROP, $name)} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=2.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | $prop->{cgi}->$name(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 71 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 71 | foreach my $item ([referer => 'HTTP_REFERER'] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | , map([lc($_) => uc($_)] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | , qw/REMOTE_ADDR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | REQUEST_METHOD | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | SCRIPT_NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | PATH_INFO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | QUERY_STRING | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | SERVER_NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | SERVER_PORT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | SERVER_PROTOCOL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | CONTENT_LENGTH | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | CONTENT_TYPE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | /) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 781 | my ($method, $env) = @$item; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 781 | ▶ | *{globref(PROP, $method)} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=27.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 3 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 3 | my ($default) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 3 | ▶ | if ($prop->{env}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 3 | ▶ | $prop->{env}->{$env} // $default; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$prop->{"env"}{$env} // $default
MC/DC0%0/2
$prop->{"env"}{$env} // $default
$prop->{"env"}{$env}
$default
Truth table33%1/3
A // B
A= $prop->{"env"}{$env}B= $default
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | ▶ | } elsif ($prop->{cgi} and my $sub = $prop->{cgi}->can($method)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$prop->{"cgi"} and my $sub = $prop->{"cgi"}->can($method)
MC/DC0%0/2
$prop->{"cgi"} and my $sub = $prop->{"cgi"}->can($method)
$prop->{"cgi"}
my $sub = $prop->{"cgi"}->can($method)
Truth table0%0/3
A and B
A= $prop->{"cgi"}B= my $sub = $prop->{"cgi"}->can($method)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | $sub->($prop->{cgi}) // $default; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
&$sub($prop->{"cgi"}) // $default
MC/DC0%0/2
&$sub($prop->{"cgi"}) // $default
&$sub($prop->{"cgi"})
$default
Truth table0%0/3
A // B
A= &$sub($prop->{"cgi"})B= $default
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | $default; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 781 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 71 | foreach my $name (qw(file subpath parameters request_file)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 284 | ▶ | *{globref(PROP, $name)} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 6 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 6 | $prop->{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 284 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 460 | ▶ | sub param { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
param: called CC=12 SCAR=40.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 460 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 460 | ▶ | if (my $ixh = $prop->{parameters}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 460 | ▶ | return keys %$ixh unless @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 64 | ▶ | defined (my $key = shift) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | or croak "undefined key!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 64 | ▶ | $key =~ s/\[\]\z// if not $prop->{no_nested_query}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 64 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | if (@_ >= 2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | $ixh->{$key} = [@_] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | $ixh->{$key} = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | # If parameters is enabled, value is returned AS-IS. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 64 | $ixh->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } elsif (my $hmv = $prop->{hmv}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | ▶ | return $hmv->keys unless @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | if (@_ == 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | return wantarray ? $hmv->get_all($_[0]) : $hmv->get($_[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | $hmv->add(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | return $glob; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | } elsif (my $cgi = $prop->{cgi}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | return $cgi->param(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | croak "Neither Hash::MultiValue nor CGI is found in connection!"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | # Annoying multi_param support. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 117 | ▶ | sub multi_param { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
multi_param: called CC=10 SCAR=39.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 117 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 117 | ▶ | if (my $ixh = $prop->{parameters}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 117 | ▶ | return keys %$ixh unless @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 117 | ▶ | defined (my $key = shift) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | or croak "undefined key!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | # If parameters is enabled, value is returned AS-IS. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 117 | $ixh->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | ▶ | } elsif (my $hmv = ($prop->{hmv} // do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$prop->{"hmv"} // do {
$prop->{"is_psgi"} and $prop->{"cgi"}->parameters
}
MC/DC0%0/2
$prop->{"hmv"} // do {
$prop->{"is_psgi"} and $prop->{"cgi"}->parameters
}
$prop->{"hmv"}
do {
$prop->{"is_psgi"} and $prop->{"cgi"}->parameters
}
Truth table0%0/3
A // B
A= $prop->{"hmv"}B= do {
$prop->{"is_psgi"} and $prop->{"cgi"}->parameters
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | $prop->{is_psgi} && $prop->{cgi}->parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | })) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$prop->{'is_psgi'} && $prop->{'cgi'}->parameters
MC/DC0%0/2
$prop->{'is_psgi'} && $prop->{'cgi'}->parameters
$prop->{'is_psgi'}
$prop->{'cgi'}->parameters
Truth table0%0/3
A && B
A= $prop->{'is_psgi'}B= $prop->{'cgi'}->parameters
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | return $hmv->keys unless @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | return wantarray ? $hmv->get_all($_[0]) : $hmv->get($_[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | } elsif (my $cgi = $prop->{cgi}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | return $cgi->multi_param(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | croak "Neither Hash::MultiValue nor CGI is found in connection!"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 399 | ▶ | sub sigil_type_item { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sigil_type_item: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 399 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 399 | ▶ | @{$prop->{_sigil_type_item} // []}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$prop->{"_sigil_type_item"} // []
MC/DC0%0/1
$prop->{"_sigil_type_item"} // []
$prop->{"_sigil_type_item"}
Truth table50%1/2
A
A= $prop->{"_sigil_type_item"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 546 | ▶ | sub collect_request_sigil_by { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
collect_request_sigil_by: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 546 | my ($glob, $cutter, @list) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 546 | my %dict; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 546 | foreach my $name (grep {defined} @list) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 282 | ▶ | my ($sigil, $word) = $name =~ /^([~!])(\1|\w*)$/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 66 | ▶ | defined (my $value = $cutter->($name)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 66 | push @{$dict{$sigil}}, do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 66 | ▶ | if ($sigil eq $word) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 52 | $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 14 | $word; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 546 | \%dict; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 965 | ▶ | sub has_content { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_content: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 965 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | my Env $env = $prop->{env} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 965 | ▶ | or return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 964 | ▶ | ($env->{CONTENT_TYPE} and defined $env->{CONTENT_LENGTH}) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$env->{"CONTENT_TYPE"} and defined $env->{"CONTENT_LENGTH"}
MC/DC50%1/2
$env->{"CONTENT_TYPE"} and defined $env->{"CONTENT_LENGTH"}
$env->{"CONTENT_TYPE"}
defined $env->{"CONTENT_LENGTH"}
Truth table66%2/3
A and B
A= $env->{"CONTENT_TYPE"}B= defined $env->{"CONTENT_LENGTH"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 484 | ▶ | sub parse_request_sigil_psgi { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_request_sigil_psgi: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 484 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 484 | my ($req) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 484 | ▶ | if ($glob->has_content) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 24 | $prop->{_sigil_type_item} = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 24 | my @bodyParams = $glob->extract_sigil_from_hmv($req->body_parameters); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 22 | my @queryParams = $glob->extract_sigil_from_hmv($req->query_parameters); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 22 | ▶ | if (@bodyParams) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | \@bodyParams | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 3 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | \@queryParams | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 19 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 460 | $glob->parse_request_sigil_hmv($req->parameters); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 484 | ▶ | sub parse_request_sigil_hmv { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_request_sigil_hmv: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 484 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 484 | my ($hmvOrRawHash) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 484 | ▶ | my $hmv = ref $hmvOrRawHash eq 'HASH' ? Hash::MultiValue->new(%$hmvOrRawHash) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | : $hmvOrRawHash; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 484 | $prop->{_sigil_type_item} = [$glob->extract_sigil_from_hmv($hmv)]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 530 | ▶ | sub extract_sigil_from_hmv { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
extract_sigil_from_hmv: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 530 | my ($glob, $hmv) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | my $sigilsDict = $glob->collect_request_sigil_by( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 66 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 66 | my $value = $hmv->{$_[0]}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 66 | $hmv->remove($_[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 66 | $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 530 | }, $hmv->keys); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 530 | $glob->validate_request_sigils_dict($sigilsDict); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 16 | ▶ | sub parse_request_sigil_cgi { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_request_sigil_cgi: called CC=1 SCAR=0.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 16 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 16 | my ($cgi) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | my $sigilsDict = $glob->collect_request_sigil_by( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | my $value = $cgi->param($_[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | $cgi->delete($_[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 16 | }, $cgi->param()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | $prop->{_sigil_type_item} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 16 | = [$glob->validate_request_sigils_dict($sigilsDict)]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 546 | ▶ | sub validate_request_sigils_dict { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate_request_sigils_dict: called CC=11 SCAR=24.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 546 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 546 | my ($sigilsDict) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 546 | my ($subpage, $action); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 546 | ▶ | if (my $names = $sigilsDict->{'~'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 50 | ▶ | if (@$names >= 2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | $glob->error("Multiple subpage sigils in request!: %s" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | , join(", ", @$names)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 50 | $subpage = $names->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 546 | ▶ | if (my $names = $sigilsDict->{'!'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 16 | ▶ | if (@$names >= 2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | $glob->error("Multiple action sigils in request!: %s" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | , join(", ", @$names)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 16 | $action = $names->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 546 | ▶ | if (defined $subpage and defined $action) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition66%2/3
defined $subpage and defined $action
MC/DC0%0/2
defined $subpage and defined $action
defined $subpage
defined $action
Truth table66%2/3
A and B
A= defined $subpageB= defined $action
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | # XXX: Reserved for future use. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | $glob->error("Can't use subpage and action at one time: %s vs %s" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | , $subpage, $action); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | } elsif (defined $subpage) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 50 | ▶ | unless ($subpage =~ m{^\w*\z}a) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 9 | $glob->error(+{http_status_code => 400}, "Invalid subpage: %s", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | YATT::Lite::Util::escape($subpage)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 41 | (page => $subpage); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | } elsif (defined $action) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 16 | ▶ | unless ($action =~ m{^\w*\z}a) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 8 | $glob->error(+{http_status_code => 400}, "Invalid action: %s", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | YATT::Lite::Util::escape($action)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 8 | (action => $action); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 480 | (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 10 | ▶ | sub queryobj { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
queryobj: called CC=3 SCAR=11.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 10 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 10 | ▶ | $prop->{parameters} || $prop->{hmv} || $prop->{cgi}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$prop->{"parameters"} or $prop->{"hmv"}
MC/DC0%0/2
$prop->{"parameters"} or $prop->{"hmv"}
$prop->{"parameters"}
$prop->{"hmv"}
Truth table66%2/3
A or B
A= $prop->{"parameters"}B= $prop->{"hmv"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | # GH-259: For url reproduction (mkquery($CON), current_path($CON)...), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | # requests with a body should reproduce QUERY_STRING-derived params only. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | # Note: query_parameters below is the sigil-stripped, request-cached | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | # Hash::MultiValue (see extract_sigil_from_hmv). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | # Set mkquery_with_body_params to restore the old merged behavior. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 19 | ▶ | sub queryobj_for_mkquery { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
queryobj_for_mkquery: called CC=6 SCAR=18.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 19 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 19 | ▶ | if (not $prop->{mkquery_with_body_params} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%10/12
not $prop->{"mkquery_with_body_params"} || $prop->{"hmv"} and $prop->{"is_psgi"} and $prop->{"cgi"} and $glob->has_content
not $prop->{"mkquery_with_body_params"} || $prop->{"hmv"} and $prop->{"is_psgi"} and $prop->{"cgi"}
not $prop->{"mkquery_with_body_params"} || $prop->{"hmv"} and $prop->{"is_psgi"}
$prop->{'mkquery_with_body_params'} || $prop->{'hmv'}
MC/DC60%3/5
not $prop->{"mkquery_with_body_params"} || $prop->{"hmv"} and $prop->{"is_psgi"} and $prop->{"cgi"} and $glob->has_content
$prop->{'mkquery_with_body_params'}
$prop->{'hmv'}
$prop->{"is_psgi"}
$prop->{"cgi"}
$glob->has_content
Truth table66%4/6
not(A || B) and C and D and E
A= $prop->{'mkquery_with_body_params'}B= $prop->{'hmv'}C= $prop->{"is_psgi"}D= $prop->{"cgi"}E= $glob->has_content
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | and not $prop->{hmv} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | and $prop->{is_psgi} and $prop->{cgi} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | and $glob->has_content) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 9 | $prop->{cgi}->query_parameters; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 10 | $glob->queryobj; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | sub param_exists { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
param_exists: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | my ($glob, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | exists $glob->as_hash->{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 4 | ▶ | sub as_hash { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_hash: called CC=4 SCAR=22.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 4 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 4 | ▶ | $prop->{parameters} // $prop->{hmv} // do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
($prop->{"parameters"} // $prop->{"hmv"}) // do {
if ($prop->{"is_psgi"}) {
$prop->{"cgi"}->parameters;
}
else {
$prop->{"cgi"}->Vars;
}
}
$prop->{"parameters"} // $prop->{"hmv"}
MC/DC0%0/3
($prop->{"parameters"} // $prop->{"hmv"}) // do {
if ($prop->{"is_psgi"}) {
$prop->{"cgi"}->parameters;
}
else {
$prop->{"cgi"}->Vars;
}
}
$prop->{"parameters"}
$prop->{"hmv"}
do {
if ($prop->{"is_psgi"}) {
$prop->{"cgi"}->parameters;
}
else {
$prop->{"cgi"}->Vars;
}
}
Truth table25%1/4
A // B // C
A= $prop->{"parameters"}B= $prop->{"hmv"}C= do {
if ($prop->{"is_psgi"}) {
$prop->{"cgi"}->parameters;
}
else {
$prop->{"cgi"}->Vars;
}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | ▶ | if ($prop->{is_psgi}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | $prop->{cgi}->parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | $prop->{cgi}->Vars | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 71 | *remove_param = *delete_param; *remove_param = *delete_param; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | ▶ | sub delete_param { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete_param: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | my ($key) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | ▶ | unless (defined $key) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | croak "Undefined key!"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | ▶ | if (my $dict = $prop->{parameters}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | # For nested_query (array_param) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | delete $dict->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | } elsif ($dict = $prop->{hmv}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | # For direct Hash::MultiValue. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | $dict->remove($key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | } elsif (($dict = $prop->{cgi})->can("parameters")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | # For Plack::Request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | $dict->parameters->remove($key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | } elsif ($dict->can("delete")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | # For CGI family. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | $dict->delete($key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | croak "No queryobj found!"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 683 | ▶ | sub after_create { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
after_create: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 683 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 683 | $glob->SUPER::after_create(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | # If cgi is empty and parameters is given, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | # request sigils are collected via parse_request_sigil_hmv. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 683 | ▶ | if (not $prop->{cgi} and $prop->{parameters}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $prop->{"cgi"} and $prop->{"parameters"}
MC/DC100%2/2
not $prop->{"cgi"} and $prop->{"parameters"}
not $prop->{"cgi"}
$prop->{"parameters"}
Truth table100%3/3
not(A) and B
A= not $prop->{"cgi"}B= $prop->{"parameters"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 24 | $glob->parse_request_sigil_hmv($prop->{parameters}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 631 | ▶ | sub configure_cgi { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
configure_cgi: called CC=6 SCAR=18.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 631 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 631 | $prop->{cgi} = my $cgi = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 631 | ▶ | return unless $glob->is_form_content_type($cgi->content_type); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 631 | ▶ | return if $prop->{parameters}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | # parse_request_sigil should be called before parse_nested_query. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 500 | ▶ | if ($prop->{is_psgi}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 484 | $glob->parse_request_sigil_psgi($cgi); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 16 | $glob->parse_request_sigil_cgi($cgi); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 483 | ▶ | unless ($prop->{no_nested_query}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 483 | ▶ | if ($prop->{is_psgi}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 467 | $glob->convert_array_param_psgi($cgi); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 16 | $glob->convert_array_param_cgi($cgi); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 631 | ▶ | sub is_form_content_type { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_form_content_type: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 631 | my ($self, $real_ct) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 631 | ▶ | return 1 if ($real_ct // '') eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$real_ct // ""
MC/DC100%1/1
$real_ct // ""
$real_ct
Truth table100%2/2
A
A= $real_ct
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 24 | foreach my $check_ct ($self->form_content_types) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 46 | ▶ | return 1 if $real_ct =~ $check_ct; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 24 | ▶ | sub form_content_types { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
form_content_types: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 24 | (qr(^multipart/form-data\s*(?:;|$))i | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | , qr(^application/x-www-form-urlencoded$)i); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 505 | ▶ | sub parse_nested_query { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_nested_query: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 505 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 505 | my ($obj_or_string) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | YATT::Lite::Util::parse_nested_query | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | ($obj_or_string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | , (!$prop->{no_unicode_params} && $prop->{encoding}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 505 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
!$prop->{'no_unicode_params'} && $prop->{'encoding'}
MC/DC0%0/2
!$prop->{'no_unicode_params'} && $prop->{'encoding'}
!$prop->{'no_unicode_params'}
$prop->{'encoding'}
Truth table33%1/3
not(A) && B
A= !$prop->{'no_unicode_params'}B= $prop->{'encoding'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 467 | ▶ | sub convert_array_param_psgi { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
convert_array_param_psgi: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 467 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 467 | my ($req) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 467 | $prop->{parameters} = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 467 | ▶ | if ($glob->has_content) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 22 | my $body = $glob->parse_nested_query([$req->body_parameters->flatten]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 22 | my $qs = $glob->parse_nested_query([$req->query_parameters->flatten]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 22 | foreach my $key (keys %$qs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 11 | ▶ | if (exists $body->{$key}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | die $glob->error("Attempt to overwrite a POST parameter '%s'" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | . " by the same one in QUERY_STRING" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | , $key); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 11 | $body->{$key} = $qs->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 22 | $body; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 445 | $glob->parse_nested_query([$req->query_parameters->flatten]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 16 | ▶ | sub convert_array_param_cgi { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
convert_array_param_cgi: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 16 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 16 | my ($cgi) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 16 | ▶ | return if ($cgi->content_type // "") eq "application/json"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$cgi->content_type // ""
MC/DC0%0/1
$cgi->content_type // ""
$cgi->content_type
Truth table50%1/2
A
A= $cgi->content_type
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | $prop->{parameters} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 16 | = $glob->parse_nested_query($cgi->query_string); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | # Location(path part of url) of overall SiteApp. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 10 | ▶ | sub site_location { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
site_location: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 10 | shift->site_prefix . '/'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 71 | *site_loc = *site_location; *site_loc = *site_location; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 75 | ▶ | sub site_prefix { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
site_prefix: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 75 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | # Note: This is safe because site_prefix 0 is meaningless(I hope). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 75 | ▶ | $prop->{site_prefix} || do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 49 | my Env $env = $prop->{env}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 49 | ▶ | $env->{'yatt.script_name'} // '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$env->{"yatt.script_name"} // ""
MC/DC0%0/1
$env->{"yatt.script_name"} // ""
$env->{"yatt.script_name"}
Truth table50%1/2
A
A= $env->{"yatt.script_name"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | # Location of DirApp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 6 | ▶ | sub location { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
location: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 6 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 6 | ▶ | (my $loc = ($prop->{location} // '')) =~ s,/*$,/,; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$prop->{"location"} // ""
MC/DC0%0/1
$prop->{"location"} // ""
$prop->{"location"}
Truth table50%1/2
A
A= $prop->{"location"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 6 | $loc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 16 | ▶ | sub _invoke_or { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_invoke_or: called CC=3 SCAR=13.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 16 | my ($default, $obj, $method, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 16 | ▶ | if (defined $obj and my $sub = $obj->can($method)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $obj and my $sub = $obj->can($method)
MC/DC0%0/2
defined $obj and my $sub = $obj->can($method)
defined $obj
my $sub = $obj->can($method)
Truth table33%1/3
A and B
A= defined $objB= my $sub = $obj->can($method)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 16 | $sub->($obj, @args) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | $default; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | # XXX: parameter の加減算も? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | # XXX: 絶対 path/相対 path の選択? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | # scheme | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | # authority | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | # path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | # query | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | # fragment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 31 | ▶ | sub mkurl { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mkurl: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 31 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 31 | my ($file, $param, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 31 | my $path = $glob->mkpath($file, $opts{mapped_path}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | # XXX: /../ truncation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | # XXX: If sep is '&', scalar ref quoting is required. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | # XXX: connection should have default separator. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 31 | my $url = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 31 | ▶ | $url .= $glob->mkprefix unless $opts{local}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 31 | $url .= $path . $glob->mkquery($param, $opts{separator}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 31 | $url; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 31 | ▶ | sub mkpath { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mkpath: called CC=8 SCAR=20.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 31 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 31 | my ($file, $used_mapped_path) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 31 | my $req = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 31 | ▶ | if ($used_mapped_path) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | # GH-251: mapped_path reproduces the url path of the request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | # (mount prefix included, request_file based). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 13 | scalar $glob->mapped_path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 18 | $glob->request_path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 31 | ▶ | if (defined $file and $file =~ m!^/!) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $file and $file =~ m[^/]
MC/DC0%0/2
defined $file and $file =~ m[^/]
defined $file
$file =~ m[^/]
Truth table66%2/3
A and B
A= defined $fileB= $file =~ m[^/]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | $glob->site_prefix.$file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 31 | my ($orig, $dir) = (''); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 31 | ▶ | if (($dir = $req) =~ s{([^/]+)$ }{}x) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 27 | $orig = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 31 | ▶ | if (not defined $file or $file eq '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
not defined $file or $file eq ""
MC/DC100%2/2
not defined $file or $file eq ""
not defined $file
$file eq ""
Truth table100%3/3
not(A) or B
A= not defined $fileB= $file eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 25 | $dir . $orig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | } elsif ($file eq '.') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 2 | $dir | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 4 | $dir . $file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 22 | ▶ | sub mkprefix { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mkprefix: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 22 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 22 | my Env $env = $prop->{env}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | my $scheme | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | = $env->{HTTP_X_FORWARDED_PROTO} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 22 | ▶ | || $env->{'psgi.url_scheme'} || $prop->{cgi}->protocol; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition83%5/6
$env->{'HTTP_X_FORWARDED_PROTO'} || $env->{'psgi.url_scheme'} || $prop->{'cgi'}->protocol
$env->{"HTTP_X_FORWARDED_PROTO"} or $env->{"psgi.url_scheme"}
MC/DC0%0/3
$env->{'HTTP_X_FORWARDED_PROTO'} || $env->{'psgi.url_scheme'} || $prop->{'cgi'}->protocol
$env->{"HTTP_X_FORWARDED_PROTO"}
$env->{"psgi.url_scheme"}
$prop->{'cgi'}->protocol
Truth table75%3/4
A or B || C
A= $env->{"HTTP_X_FORWARDED_PROTO"}B= $env->{"psgi.url_scheme"}C= $prop->{'cgi'}->protocol
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 22 | my $host = $glob->mkhost($scheme); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 22 | $scheme . '://' . $host . join("", @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | # $CON->has_htdebug($name): per-request cache of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | # $SYS->has_htdebug($name) (YATT::Lite::WebMVC0::SiteApp), which does an | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | # %ENV lookup and a stat() of $app_root/.htdebug_$name every time. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | # escape() consults this for every reference it is asked to print, so | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | # the answer is computed at most once per connection and name. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 19 | ▶ | sub has_htdebug { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_htdebug: called CC=6 SCAR=18.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 19 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 19 | my ($name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 19 | ▶ | my $cache = $prop->{_htdebug_cache} //= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$prop->{"_htdebug_cache"} //= {}
MC/DC100%1/1
$prop->{"_htdebug_cache"} //= {}
$prop->{"_htdebug_cache"}
Truth table100%2/2
A
A= $prop->{"_htdebug_cache"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 19 | ▶ | return $cache->{$name} if exists $cache->{$name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 17 | $cache->{$name} = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 17 | my $sys = $prop->{system}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 17 | ▶ | ($sys and $sys->can('has_htdebug')) ? ($sys->has_htdebug($name) // 0) : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition60%3/5
$sys and $sys->can("has_htdebug")
$sys->has_htdebug($name) // 0
MC/DC0%0/2
$sys and $sys->can("has_htdebug")
$sys
$sys->can("has_htdebug")
MC/DC100%1/1
$sys->has_htdebug($name) // 0
$sys->has_htdebug($name)
Truth table33%1/3
A and B
A= $sysB= $sys->can("has_htdebug")
Truth table100%2/2
A
A= $sys->has_htdebug($name)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | # True if this request came over TLS (see YATT::Lite::PSGIEnv::is_https). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 7 | ▶ | sub is_https { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_https: called CC=6 SCAR=30.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 7 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 7 | ▶ | if (my Env $env = $prop->{env}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 7 | Env->is_https($env); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | } elsif (my $cgi = $prop->{cgi}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | ▶ | ($cgi->can('protocol') and lc($cgi->protocol // '') eq 'https') ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
$cgi->can("protocol") and lc($cgi->protocol // "") eq "https"
$cgi->protocol // ""
MC/DC0%0/2
$cgi->can("protocol") and lc($cgi->protocol // "") eq "https"
$cgi->can("protocol")
$cgi->protocol
Truth table0%0/3
A and B
A= $cgi->can("protocol")B= $cgi->protocol
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | ▶ | sub http_host_domain { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
http_host_domain: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | my Env $env = $prop->{env}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | my $host = $env->{HTTP_HOST} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | ▶ | or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | $host =~ s/:\d+$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | $host; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | ▶ | sub server_name_or_localhost { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
server_name_or_localhost: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 0 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | my ($default) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | my Env $env = $prop->{env}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | ▶ | $env->{SERVER_NAME} || ($default // 'localhost'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
$env->{'SERVER_NAME'} || ($default // 'localhost')
$default // "localhost"
MC/DC0%0/2
$env->{'SERVER_NAME'} || ($default // 'localhost')
$env->{'SERVER_NAME'}
$default
Truth table0%0/3
A || B
A= $env->{'SERVER_NAME'}B= $default
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 43 | ▶ | sub mkhost { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mkhost: called CC=10 SCAR=28.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 43 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 43 | my ($scheme) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 43 | ▶ | $scheme ||= 'http'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$scheme ||= "http"
MC/DC100%1/1
$scheme ||= "http"
$scheme
Truth table100%2/2
A
A= $scheme
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 43 | my Env $env = $prop->{env}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | # XXX? Is this secure? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 43 | ▶ | return $env->{HTTP_HOST} if nonempty($env->{HTTP_HOST}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | my $base = $env->{SERVER_NAME} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 8 | ▶ | // _invoke_or('localhost', $prop->{cgi}, 'server_name'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$env->{"SERVER_NAME"} // _invoke_or("localhost", $prop->{"cgi"}, "server_name")
MC/DC0%0/2
$env->{"SERVER_NAME"} // _invoke_or("localhost", $prop->{"cgi"}, "server_name")
$env->{"SERVER_NAME"}
_invoke_or("localhost", $prop->{"cgi"}, "server_name")
Truth table33%1/3
A // B
A= $env->{"SERVER_NAME"}B= _invoke_or("localhost", $prop->{"cgi"}, "server_name")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 8 | ▶ | if (my $port = $env->{SERVER_PORT} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$env->{'SERVER_PORT'} || _invoke_or(80, $prop->{'cgi'}, 'server_port')
MC/DC0%0/2
$env->{'SERVER_PORT'} || _invoke_or(80, $prop->{'cgi'}, 'server_port')
$env->{'SERVER_PORT'}
_invoke_or(80, $prop->{'cgi'}, 'server_port')
Truth table33%1/3
A || B
A= $env->{'SERVER_PORT'}B= _invoke_or(80, $prop->{'cgi'}, 'server_port')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | || _invoke_or(80, $prop->{cgi}, 'server_port')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 8 | ▶ | $base .= ":$port" unless ($scheme eq 'http' and $port == 80 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition22%2/9
$scheme eq "http" and $port == 80 or $scheme eq "https" and $port == 443
$scheme eq "http" and $port == 80
$scheme eq "https" and $port == 443
MC/DC0%0/4
$scheme eq "http" and $port == 80 or $scheme eq "https" and $port == 443
$scheme eq "http"
$port == 80
$scheme eq "https"
$port == 443
Truth table14%1/7
A and B or C and D
A= $scheme eq "http"B= $port == 80C= $scheme eq "https"D= $port == 443
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | or $scheme eq 'https' and $port == 443); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 8 | $base; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 102 | ▶ | sub mkquery { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mkquery: called CC=19 SCAR=30.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 102 | my ($self, $param, $sep) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 102 | ▶ | $sep //= '&'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$sep //= "&"
MC/DC0%0/1
$sep //= "&"
$sep
Truth table50%1/2
A
A= $sep
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 102 | my @enc_param; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 102 | my ($fkeys, $fgetall); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 102 | ▶ | if (not defined $param or not ref $param) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $param and ref $param
MC/DC100%2/2
defined $param and ref $param
defined $param
ref $param
Truth table100%3/3
A and B
A= defined $paramB= ref $param
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 62 | ▶ | return wantarray ? () : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | # nop | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 40 | ▶ | if (UNIVERSAL::isa($param, ref $self)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | # $CON->mkquery($CON) == $CON->mkquery($CON->queryobj_for_mkquery) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 19 | $param = $param->queryobj_for_mkquery; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 40 | ▶ | if (ref $param eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | push @enc_param, $self->url_encode($_).'='.$self->url_encode($param->{$_}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 9 | for sort keys %$param; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | ▶ | } elsif ($fkeys = UNIVERSAL::can($param, 'keys') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%4/6
$fkeys = UNIVERSAL::can($param, "keys") and $fgetall = UNIVERSAL::can($param, "get_all") or $fkeys = $fgetall = UNIVERSAL::can($param, "param")
$fkeys = UNIVERSAL::can($param, "keys") and $fgetall = UNIVERSAL::can($param, "get_all")
MC/DC33%1/3
$fkeys = UNIVERSAL::can($param, "keys") and $fgetall = UNIVERSAL::can($param, "get_all") or $fkeys = $fgetall = UNIVERSAL::can($param, "param")
$fkeys = UNIVERSAL::can($param, "keys")
$fgetall = UNIVERSAL::can($param, "get_all")
$fkeys = $fgetall = UNIVERSAL::can($param, "param")
Truth table40%2/5
A and B or C
A= $fkeys = UNIVERSAL::can($param, "keys")B= $fgetall = UNIVERSAL::can($param, "get_all")C= $fkeys = $fgetall = UNIVERSAL::can($param, "param")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | and $fgetall = UNIVERSAL::can($param, 'get_all') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | or ($fkeys = $fgetall = UNIVERSAL::can($param, 'param'))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 13 | foreach my $key (YATT::Lite::Util::unique($fkeys->($param))) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 18 | my $enc = $self->url_encode($key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | push @enc_param, "$enc=".$self->url_encode($_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 18 | for $fgetall->($param, $key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | } elsif (ref $param eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 18 | ▶ | if (grep {not defined} @$param) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 0 | croak "Undef found in mkquery()! " . YATT::Lite::Util::terse_dump($param); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 18 | my @list = @$param; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 18 | ▶ | while (my ($key, $value) = splice @list, 0, 2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 19 | push @enc_param, $self->url_encode($key).'='.$self->url_encode($value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 40 | ▶ | unless (@enc_param) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 3 | ▶ | wantarray ? () : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 37 | ▶ | wantarray ? @enc_param : '?'.join($sep, @enc_param); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | # GH-251: Mount-prefix aware link builders. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | # Naming follows the widespread "*_path = path only / *_url = absolute URL" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | # convention. $query accepts only HASH/ARRAY ref or query object (like $CON). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 39 | ▶ | sub site_path { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
site_path: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 39 | my ($glob, $path, $query) = splice @_, 0, 3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 39 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 1 | croak "Too many arguments for site_path!" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | . " (query parameters must be passed as one HASH/ARRAY ref)"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 38 | ▶ | if (not defined $path or $path eq '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
not defined $path or $path eq ""
MC/DC50%1/2
not defined $path or $path eq ""
not defined $path
$path eq ""
Truth table66%2/3
not(A) or B
A= not defined $pathB= $path eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 16 | $path = '/'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | } elsif ($path !~ m{^/}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 1 | croak "site_path requires a '/'-leading path: $path"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 37 | $glob->site_prefix . $path . $glob->_query_string_of(site_path => $query); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 1 | ▶ | sub site_url { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
site_url: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 1 | my $glob = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 1 | $glob->mkprefix . $glob->site_path(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 28 | ▶ | sub current_path { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
current_path: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 28 | my ($glob, $query) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 28 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 1 | croak "Too many arguments for current_path!" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | . " (query parameters must be passed as one HASH/ARRAY ref)"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 27 | $glob->request_path . $glob->_query_string_of(current_path => $query); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 1 | ▶ | sub current_url { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
current_url: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 1 | my $glob = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 1 | $glob->mkprefix . $glob->current_path(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 64 | ▶ | sub _query_string_of { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_query_string_of: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 64 | my ($glob, $caller, $query) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 64 | ▶ | if (defined $query and not ref $query) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $query and not ref $query
MC/DC100%2/2
defined $query and not ref $query
defined $query
not ref $query
Truth table100%3/3
A and not(B)
A= defined $queryB= not ref $query
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 1 | croak "query for $caller must be a HASH/ARRAY ref or query object: $query"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 63 | scalar $glob->mkquery($query); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 46 | ▶ | sub dir_location { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dir_location: called CC=3 SCAR=11.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 46 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 46 | my Env $env = $prop->{env}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 46 | ▶ | ($env->{'yatt.script_name'} // '').($prop->{location} // "/"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$env->{"yatt.script_name"} // ""
$prop->{"location"} // "/"
MC/DC0%0/1
$env->{"yatt.script_name"} // ""
$env->{"yatt.script_name"}
MC/DC0%0/1
$prop->{"location"} // "/"
$prop->{"location"}
Truth table50%1/2
A
A= $env->{"yatt.script_name"}
Truth table50%1/2
A
A= $prop->{"location"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | ▶ | sub file_page { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
file_page: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 0 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 0 | my $fn = $prop->{file}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 0 | $fn =~ s/\.\w+\z//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 0 | $fn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | # The url path of the current page: dir_location + request_file. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | # GH-251: Like mapped_path, this follows how the request spelled the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | # file name (Apache content-negotiation model: the requested name is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | # the base name; negotiation just appends extensions to it). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 33 | ▶ | sub file_location { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
file_location: called CC=4 SCAR=14.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 33 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 33 | my Env $env = $prop->{env}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 33 | my $loc = $glob->dir_location; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 33 | ▶ | if (defined (my $rf = $prop->{request_file})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 32 | $loc . $rf; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | ▶ | } elsif (not $prop->{is_index} and my $fn = $prop->{file}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
not $prop->{"is_index"} and my $fn = $prop->{"file"}
MC/DC0%0/2
not $prop->{"is_index"} and my $fn = $prop->{"file"}
not $prop->{"is_index"}
my $fn = $prop->{"file"}
Truth table33%1/3
not(A) and B
A= not $prop->{"is_index"}B= my $fn = $prop->{"file"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | # Fallback for old-style connections without request_file: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | # trim the last extension ("foo.tar.yatt" => "foo.tar"). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 1 | $fn =~ s/\.\w+\z//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 1 | $loc . $fn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 0 | $loc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | # page_location: canonical form of file_location, based on the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | # physical file name. Unlike file_location, this is NOT affected by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | # how the request spelled the url. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | # (page = spelling-independent identity, cf. is_current_page) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 13 | ▶ | sub page_location { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
page_location: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 13 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 13 | my $loc = $glob->dir_location; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 13 | ▶ | if (not $prop->{is_index} and my $fn = $prop->{file}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $prop->{"is_index"} and my $fn = $prop->{"file"}
MC/DC50%1/2
not $prop->{"is_index"} and my $fn = $prop->{"file"}
not $prop->{"is_index"}
my $fn = $prop->{"file"}
Truth table66%2/3
not(A) and B
A= not $prop->{"is_index"}B= my $fn = $prop->{"file"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | 11 | $fn =~ s/\.\w+\z//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 11 | $loc .= $fn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 13 | $loc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | # is_current_file($path): true when $path addresses the current page. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | # $path is a site-rooted literal (same form as site_path's argument): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | # canonical (/auth/login), physical (/auth/login.yatt), or directory | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | # form for index pages (/auth/). Mount prefix and request spelling | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | # do not affect the result. Subpath is ignored (cf. is_current_page). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 6 | ▶ | sub is_current_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_current_file: called CC=7 SCAR=19.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 6 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 6 | my ($path) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 6 | ▶ | return 0 unless defined $path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 6 | my $loc = $glob->location; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 6 | ▶ | my $fn = $prop->{file} // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$prop->{"file"} // ""
MC/DC0%0/1
$prop->{"file"} // ""
$prop->{"file"}
Truth table50%1/2
A
A= $prop->{"file"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 6 | (my $canon = $fn) =~ s/\.\w+\z//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 6 | ▶ | return 1 if $path eq $loc . $canon; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 4 | ▶ | return 1 if $path eq $loc . $fn; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 3 | ▶ | return 1 if $prop->{is_index} and $path eq $loc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$prop->{"is_index"} and $path eq $loc
MC/DC50%1/2
$prop->{"is_index"} and $path eq $loc
$prop->{"is_index"}
$path eq $loc
Truth table66%2/3
A and B
A= $prop->{"is_index"}B= $path eq $loc
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 2 | 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | 576 | ▶ | sub is_current_page { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_current_page: called CC=6 SCAR=18.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 576 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 576 | my ($file, $page) = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | 576 | ▶ | @_ <= 1 ? (rootname($prop->{file}), $_[0]) : @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 576 | ▶ | rootname($prop->{file}) eq $file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | or return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 576 | ▶ | $page //= ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$page //= ""
MC/DC100%1/1
$page //= ""
$page
Truth table100%2/2
A
A= $page
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | 576 | $page =~ s{^/}{}; # Treat /foo as foo. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 576 | ▶ | if (empty(my $subpath = $prop->{subpath})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 192 | $page eq ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | } elsif ($page eq '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | 128 | 0 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 256 | $subpath =~ m{^/$page}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | # GH-251: mapped_path now reproduces the url path of the request: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | # site_prefix + location + request_file + subpath. Since request_file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | # keeps the file name part as it appeared in the request, extension | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | # is reproduced only when the request spelled it. For connections | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | # which lack request_file (old-style construction), falls back to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | # the physical file name as before. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 28 | ▶ | sub mapped_path { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mapped_path: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 28 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 28 | my @path = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | 28 | ▶ | my $loc = $prop->{location} // "/"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$prop->{"location"} // "/"
MC/DC100%1/1
$prop->{"location"} // "/"
$prop->{"location"}
Truth table100%2/2
A
A= $prop->{"location"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 28 | ▶ | $loc .= $prop->{request_file} // do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$prop->{"request_file"} // do {
defined $prop->{"file"} && !$prop->{"is_index"} ? $prop->{"file"} : ""
}
MC/DC0%0/2
$prop->{"request_file"} // do {
defined $prop->{"file"} && !$prop->{"is_index"} ? $prop->{"file"} : ""
}
$prop->{"request_file"}
do {
defined $prop->{"file"} && !$prop->{"is_index"} ? $prop->{"file"} : ""
}
Truth table66%2/3
A // B
A= $prop->{"request_file"}B= do {
defined $prop->{"file"} && !$prop->{"is_index"} ? $prop->{"file"} : ""
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | (defined $prop->{file} and not $prop->{is_index}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | 10 | ▶ | ? $prop->{file} : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $prop->{"file"} and not $prop->{"is_index"}
MC/DC100%2/2
defined $prop->{"file"} and not $prop->{"is_index"}
defined $prop->{"file"}
not $prop->{"is_index"}
Truth table100%3/3
A and not(B)
A= defined $prop->{"file"}B= not $prop->{"is_index"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | 28 | ($glob->site_prefix . $loc); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 28 | ▶ | if (defined (my $sp = $prop->{subpath})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | 26 | $path[0] =~ s!/+\z!!; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 26 | $sp =~ s!^/*!/!; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | 26 | push @path, $sp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | 28 | ▶ | if (wantarray) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | 5 | @path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 23 | my $res = join "", @path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | 23 | $res =~ s!^/+!/!; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 23 | $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | 46 | ▶ | sub request_path { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
request_path: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | 46 | ▶ | (my $uri = shift->request_uri // '') =~ s/\?.*//; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
(shift())->request_uri // ""
MC/DC100%1/1
(shift())->request_uri // ""
(shift())->request_uri
Truth table100%2/2
A
A= (shift())->request_uri
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | 46 | $uri; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 46 | ▶ | sub request_uri { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
request_uri: called CC=4 SCAR=15.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 46 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 46 | ▶ | if (my Env $env = $prop->{env}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | 45 | $env->{REQUEST_URI}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | ▶ | } elsif ($prop->{cgi} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$prop->{"cgi"} and my $sub = $prop->{"cgi"}->can("request_uri")
MC/DC0%0/2
$prop->{"cgi"} and my $sub = $prop->{"cgi"}->can("request_uri")
$prop->{"cgi"}
my $sub = $prop->{"cgi"}->can("request_uri")
Truth table33%1/3
A and B
A= $prop->{"cgi"}B= my $sub = $prop->{"cgi"}->can("request_uri")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | and my $sub = $prop->{cgi}->can('request_uri')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 0 | $sub->($prop->{cgi}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 1 | $ENV{REQUEST_URI}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | # True if $url, given as a plain string, stays on this origin: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | # a path or relative reference, or an absolute http(s) url whose host | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | # equals mkhost. Written against how browsers parse Location:, not | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | # against RFC 3986 alone: for http(s), '\' is treated as '/', runs of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | # slashes after the scheme collapse, and leading C0 controls / spaces | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | # are stripped before parsing. So "\\evil", "/\evil", "///evil", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | # "http:\\evil" and " //evil" all mean evil.example to a browser and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | # are rejected here. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | 78 | ▶ | sub is_same_origin_redirect_url { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_same_origin_redirect_url: called CC=15 SCAR=27.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 78 | my ($glob, $url) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | 78 | ▶ | return 0 unless defined $url and length $url; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $url and length $url
MC/DC50%1/2
defined $url and length $url
defined $url
length $url
Truth table66%2/3
A and B
A= defined $urlB= length $url
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | # Control chars (CR/LF would split the header) and whitespace. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 77 | ▶ | return 0 if $url =~ /[\x00-\x20\x7f]/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | 65 | ▶ | if ($url =~ m{^([A-Za-z][A-Za-z0-9+.-]*):(.*)\z}s) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | # Has a scheme. Only http(s) to this very host is accepted. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 28 | my ($scheme, $rest) = (lc($1), $2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | 28 | ▶ | return 0 unless $scheme eq 'http' or $scheme eq 'https'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$scheme eq "http" or $scheme eq "https"
MC/DC100%2/2
$scheme eq "http" or $scheme eq "https"
$scheme eq "http"
$scheme eq "https"
Truth table100%3/3
A or B
A= $scheme eq "http"B= $scheme eq "https"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 24 | ▶ | my ($host) = $rest =~ m{^//([^/?#\\]+)(?:[/?#]|\z)} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | or return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | 14 | ▶ | return lc($host) eq lc($glob->mkhost($scheme) // '') ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$glob->mkhost($scheme) // ""
MC/DC0%0/1
$glob->mkhost($scheme) // ""
$glob->mkhost($scheme)
Truth table50%1/2
A
A= $glob->mkhost($scheme)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | 37 | ▶ | if ($url =~ m{^//([^/?#\\]+)(?:[/?#]|\z)}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | # Scheme-relative "//host/...": accepted only for this host. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | 4 | ▶ | return lc($1) eq lc($glob->mkhost // '') ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$glob->mkhost // ""
MC/DC0%0/1
$glob->mkhost // ""
$glob->mkhost
Truth table50%1/2
A
A= $glob->mkhost
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 33 | ▶ | if ($url =~ m{^[/\\]}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | # A path. Exactly one leading '/', not followed by '/' or '\'. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | 25 | ▶ | return $url =~ m{^/(?![/\\])} ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | # Relative reference ("./", "index?x=1", "?x=1", "#frag"). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | 8 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | # GH-251: raise_redirect is the preferred name (raise_* family tells | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | # this never returns to the caller). redirect is kept for compatibility. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | 71 | *raise_redirect = *redirect; *raise_redirect = *redirect; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 83 | ▶ | sub redirect { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
redirect: called CC=6 SCAR=18.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | 83 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | 83 | ▶ | croak "undefined url" unless @_ and defined $_[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@_ and defined $_[0]
MC/DC0%0/2
@_ and defined $_[0]
@_
defined $_[0]
Truth table33%1/3
A and B
A= @_B= defined $_[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 83 | my $url = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 83 | ▶ | if (ref $_[0]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | # To do external redirect, $url should pass as SCALAR REF. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | 5 | my $arg = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | # die "redirect url is not a scalar ref: $arg"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | 5 | $$arg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | } elsif ($glob->is_same_origin_redirect_url($_[0])) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 25 | shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | 53 | die $glob->error_with_status( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | 400, "External redirect is not allowed: %s" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | , YATT::Lite::Util::escape($_[0]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 30 | ▶ | if ($prop->{_header_was_sent}++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | 0 | die "Can't redirect multiple times!"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | # Make sure session is flushed before redirection. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | 30 | $glob->finalize_headers; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | 30 | ${$prop->{buffer}} = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | 30 | die [302, [Location => $url, $glob->list_header], []]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | # Session support is delegated to 'system'. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | # 'system' must implement session_{start,resume,flush,destroy} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | # To avoid confusion against $system->session_$verb, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | # connection side interface is named ${verb}_session. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 45 | ▶ | sub get_session { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_session: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 45 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | # To avoid repeative false session tests. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | 45 | ▶ | if (exists $prop->{_session}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | 37 | $prop->{_session}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 8 | $prop->{system}->session_resume($glob); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | 0 | ▶ | sub start_session { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start_session: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | 0 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 0 | ▶ | if (defined (my $sess = $prop->{_session})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 0 | die $glob->error("load_session is called twice! sid=%s", $sess->id); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 0 | $prop->{system}->session_start($glob, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 0 | ▶ | sub delete_session { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete_session: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | 0 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 0 | $prop->{system}->session_delete($glob); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 0 | ▶ | sub flush_session { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
flush_session: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | 0 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 0 | $prop->{system}->session_flush($glob); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | 0 | ▶ | sub current_user { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
current_user: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 0 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | 0 | my $cu = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | 0 | ▶ | if (exists $prop->{_current_user}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | $prop->{_current_user} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | 0 | } elsif (defined $prop->{system}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | 0 | $prop->{_current_user} = $prop->{system}->load_current_user($glob); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | 0 | $prop->{_current_user} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | 0 | ▶ | return $cu unless @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | 0 | ▶ | die $glob->error("current_user is empty") unless defined $cu; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | 0 | my $method = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | 0 | $cu->$method(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | 71 | ▶ | use YATT::Lite::RegexpNames; # For re_name, re_integer, ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | 2 | ▶ | sub param_type { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
param_type: called CC=11 SCAR=27.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | 2 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | 2 | ▶ | my $name = shift // croak "Undefined name!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() // croak("Undefined name!")
MC/DC0%0/1
shift() // croak("Undefined name!")
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | 2 | ▶ | my $type = shift // croak "Undefined type!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() // croak("Undefined type!")
MC/DC0%0/1
shift() // croak("Undefined type!")
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | 2 | my $diag = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | 2 | my $opts = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | 2 | ▶ | my $pat = ref $type eq 'Regexp' ? $type : do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | 2 | ▶ | my $pat_sub = $glob->can("re_$type") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | or croak "Unknown type: $type"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | 2 | $pat_sub->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | 2 | my $value = $glob->param($name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | 2 | ▶ | if (defined $value && $value =~ $pat) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition66%2/3
defined $value and $value =~ /$pat/
MC/DC0%0/2
defined $value and $value =~ /$pat/
defined $value
$value =~ /$pat/
Truth table66%2/3
A and B
A= defined $valueB= $value =~ /$pat/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | 0 | return $&; # Also for taint check. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | } elsif ($diag) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | 0 | ▶ | die $glob->error_with_status | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | (400, (ref $diag eq 'CODE' ? $diag->($value) : $diag) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | , $name, $value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | } elsif (not defined $value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | 1 | ▶ | return undef if $opts->{allow_undef}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | 1 | die $glob->error_with_status | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | (400, "Parameter '%s' is missing!", $name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | # Just for default message. Production code should provide $diag. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | 1 | die $glob->error_with_status | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | (400, "Parameter '%s' must match %s!: '%s'" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | , $name, $type, $value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | 4 | ▶ | sub accept_language { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
accept_language: called CC=15 SCAR=35.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | 4 | my PROP $prop = (my $glob = shift)->prop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | 4 | my (%opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | 4 | my $filter = delete $opts{filter}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | 4 | my $detail = delete $opts{detail}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | 4 | my $long = delete $opts{long}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | 4 | ▶ | if (keys %opts) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | 0 | die $glob->error("Unknown option for accept_language: %s" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | , join ", ", keys %opts); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | 4 | my Env $env = $prop->{env}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | my $langlist = $env->{HTTP_ACCEPT_LANGUAGE} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | 4 | ▶ | or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | my @langlist = sort { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | 12 | $$b[-1] <=> $$a[-1] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | } map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | 4 | my ($lang, $qual) = split /\s*;\s*q=/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | 12 | ▶ | [$lang, $qual // 1] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$qual // 1
MC/DC100%1/1
$qual // 1
$qual
Truth table100%2/2
A
A= $qual
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | } split /\s*,\s*/, $langlist; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | 4 | ▶ | if ($filter) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | 0 | my $filtsub = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | 0 | ▶ | if (ref $filter eq 'CODE') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | 0 | $filter | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | } elsif (ref $filter eq 'Regexp') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | 0 | ▶ | sub { grep {$$_[0] =~ $filter} @_ } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | 0 | } elsif (ref $filter eq 'HASH') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | 0 | ▶ | sub { grep {$filter->{$$_[0]}} @_ } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | 0 | } elsif (ref $filter eq 'ARRAY') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | 0 | my $hash = +{map {$_ => 1} lexpand($filter)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | 0 | ▶ | sub { grep {$hash->{$$_[0]}} @_ } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 0 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | 0 | die $glob->error("Unknown filter type for accept_language"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | 0 | @langlist = $filtsub->(@langlist); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | 4 | ▶ | if ($detail) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | @langlist | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | 1 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | 3 | ▶ | if ($long) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | # en-US => en_US | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | 1 | $$_[0] =~ s/-/_/g for @langlist; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | # en-US => en | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | 2 | $$_[0] =~ s/-.*// for @langlist; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | 3 | my %dup; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | 3 | ▶ | wantarray ? (map {$dup{$$_[0]}++ ? () : $$_[0]} @langlist) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | : $langlist[0][0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | 71 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||