| 1 | package URI::_query; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 54 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 54 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 54 | ▶ | use URI (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 54 | ▶ | use URI::Escape qw(uri_unescape); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 54 | ▶ | use Scalar::Util (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 54 | our $VERSION = '5.40'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 781 | ▶ | sub query { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
query: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 781 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 781 | ▶ | $$self =~ m,^([^?\#]*)(?:\?([^\#]*))?(.*)$,s or die; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 781 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 110 | my $q = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 110 | $$self = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 110 | ▶ | if (defined $q) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 89 | $q =~ s/([^$URI::uric])/ URI::Escape::escape_char($1)/ego; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 89 | utf8::downgrade($q); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 89 | $$self .= "?$q"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 110 | $$self .= $3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 781 | $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | # Handle ...?foo=bar&bar=foo type of query | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 517 | ▶ | sub query_form { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
query_form: called CC=22 SCAR=30.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 517 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 517 | my $old = $self->query; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 517 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | # Try to set query string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 55 | my $delim; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 55 | my $r = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 55 | ▶ | if (_is_array($r)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 24 | $delim = $_[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 24 | @_ = @$r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | elsif (ref($r) eq "HASH") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 4 | $delim = $_[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 4 | @_ = map { $_ => $r->{$_} } sort keys %$r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 55 | ▶ | $delim = pop if @_ % 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 55 | my @query; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 55 | ▶ | while (my ($key, $vals) = splice(@_, 0, 2)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 106 | ▶ | $key = '' unless defined $key; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 106 | $key =~ s/([;\/?:@&=+,\$\[\]%])/ URI::Escape::escape_char($1)/eg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 106 | $key =~ s/ /+/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 106 | ▶ | $vals = [_is_array($vals) ? @$vals : $vals]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 106 | for my $val (@$vals) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 118 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 115 | $val | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 19 | =~ s/([;\/?:@&=+,\$\[\]%])/ URI::Escape::escape_char($1)/eg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 115 | $val =~ s/ /+/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 115 | push(@query, "$key=$val"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 3 | push(@query, $key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 55 | ▶ | if (@query) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 44 | ▶ | unless ($delim) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 39 | ▶ | $delim = $1 if $old && $old =~ /([&;])/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$old and $old =~ /([&;])/
MC/DC100%2/2
$old and $old =~ /([&;])/
$old
$old =~ /([&;])/
Truth table100%3/3
A and B
A= $oldB= $old =~ /([&;])/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 39 | ▶ | $delim ||= $URI::DEFAULT_QUERY_FORM_DELIMITER || "&"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition80%4/5
$delim ||= $URI::DEFAULT_QUERY_FORM_DELIMITER || "&"
$URI::DEFAULT_QUERY_FORM_DELIMITER || '&'
MC/DC0%0/2
$delim ||= $URI::DEFAULT_QUERY_FORM_DELIMITER || "&"
$delim
$URI::DEFAULT_QUERY_FORM_DELIMITER
Truth table66%2/3
A ||= B
A= $delimB= $URI::DEFAULT_QUERY_FORM_DELIMITER
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 44 | $self->query(join($delim, @query)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 11 | $self->query(undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 517 | ▶ | return if !defined($old) || !length($old) || !defined(wantarray); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
defined $old and length $old and defined wantarray
defined $old and length $old
MC/DC100%3/3
defined $old and length $old and defined wantarray
defined $old
length $old
defined wantarray
Truth table100%4/4
A and B and C
A= defined $oldB= length $oldC= defined wantarray
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 457 | ▶ | return unless $old =~ /=/; # not a form | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | (defined) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 2260 | ▶ | ? do { s/\+/ /g; uri_unescape($_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | : undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 456 | ▶ | } map { /=/ ? split(/=/, $_, 2) : ($_ => undef) } split(/[&;]/, $old); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | # Handle ...?dog+bones type of query | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 16 | ▶ | sub query_keywords { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
query_keywords: called CC=9 SCAR=22.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 16 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 16 | my $old = $self->query; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 16 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | # Try to set query string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 12 | my @copy = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 12 | ▶ | @copy = @{$copy[0]} if @copy == 1 && _is_array($copy[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@copy == 1 and _is_array($copy[0])
MC/DC100%2/2
@copy == 1 and _is_array($copy[0])
@copy == 1
_is_array($copy[0])
Truth table100%3/3
A and B
A= @copy == 1B= _is_array($copy[0])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 12 | for (@copy) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 21 | s/([;\/?:@&=+,\$\[\]%])/ URI::Escape::escape_char($1)/eg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 12 | ▶ | $self->query(@copy ? join('+', @copy) : undef); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 16 | ▶ | return if !defined($old) || !defined(wantarray); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $old and defined wantarray
MC/DC100%2/2
defined $old and defined wantarray
defined $old
defined wantarray
Truth table100%3/3
A and B
A= defined $oldB= defined wantarray
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 4 | ▶ | return if $old =~ /=/; # not keywords, but a form | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 2 | map { uri_unescape($_) } split(/\+/, $old, -1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | # Some URI::URL compatibility stuff | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 22 | ▶ | sub equery { goto &query } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
equery: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 422 | ▶ | sub query_param { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
query_param: called CC=12 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 422 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 422 | my @old = $self->query_form; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 422 | ▶ | if (@_ == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | # get keys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 1 | my (%seen, $i); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 1 | ▶ | return grep !($i++ % 2 || $seen{$_}++), @old; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$i++ % 2 || $seen{$_}++
MC/DC100%2/2
$i++ % 2 || $seen{$_}++
$i++ % 2
$seen{$_}++
Truth table100%3/3
A || B
A= $i++ % 2B= $seen{$_}++
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 421 | my $key = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 421 | ▶ | my @i = grep $_ % 2 == 0 && $old[$_] eq $key, 0 .. $#old; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$_ % 2 == 0 && $old[$_] eq $key
MC/DC100%2/2
$_ % 2 == 0 && $old[$_] eq $key
$_ % 2 == 0
$old[$_] eq $key
Truth table100%3/3
A && B
A= $_ % 2 == 0B= $old[$_] eq $key
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 421 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 11 | my @new = @old; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 11 | my @new_i = @i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 11 | ▶ | my @vals = map { _is_array($_) ? @$_ : $_ } @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 11 | ▶ | while (@new_i > @vals) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 11 | splice @new, pop @new_i, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 11 | ▶ | if (@vals > @new_i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 5 | ▶ | my $i = @new_i ? $new_i[-1] + 2 : @new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 5 | my @splice = splice @vals, @new_i, @vals - @new_i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 5 | splice @new, $i, 0, map { $key => $_ } @splice; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 11 | ▶ | if (@vals) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | #print "SET $new_i[0]\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 2 | @new[map $_ + 1, @new_i] = @vals; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 11 | $self->query_form(\@new); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 421 | ▶ | return wantarray ? @old[map $_ + 1, @i] : @i ? $old[$i[0] + 1] : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 2 | ▶ | sub query_param_append { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
query_param_append: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 2 | my $key = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 2 | ▶ | my @vals = map { _is_array($_) ? @$_ : $_ } @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 2 | $self->query_form($self->query_form, $key => \@vals); # XXX | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 3 | ▶ | sub query_param_delete { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
query_param_delete: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 3 | my $key = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 3 | my @old = $self->query_form; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 3 | my @vals; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 3 | ▶ | for (my $i = @old - 2; $i >= 0; $i -= 2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 8 | ▶ | next if $old[$i] ne $key; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 5 | push(@vals, (splice(@old, $i, 2))[1]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 3 | ▶ | $self->query_form(\@old) if @vals; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 3 | ▶ | return wantarray ? reverse @vals : $vals[-1]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 2 | ▶ | sub query_form_hash { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
query_form_hash: called CC=7 SCAR=19.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 2 | my @old = $self->query_form; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 2 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 1 | ▶ | $self->query_form(@_ == 1 ? %{shift(@_)} : @_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 2 | my %hash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 2 | ▶ | while (my ($k, $v) = splice(@old, 0, 2)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 6 | ▶ | if (exists $hash{$k}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 2 | for ($hash{$k}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 2 | ▶ | $_ = [$_] unless _is_array($_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 2 | push(@$_, $v); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 4 | $hash{$k} = $v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 2 | return \%hash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 193 | ▶ | sub _is_array { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_array: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 193 | ▶ | return ( defined($_[0]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%11/11
defined $_[0] && (builtin::reftype($_[0]) || '') eq 'ARRAY' && !(builtin::blessed($_[0]) && overload::Method($_[0], '""'))
defined $_[0] and (builtin::reftype($_[0]) || "") eq "ARRAY"
builtin::reftype($_[0]) || ''
builtin::blessed($_[0]) && overload::Method($_[0], '""')
MC/DC100%4/4
defined $_[0] && (builtin::reftype($_[0]) || '') eq 'ARRAY' && !(builtin::blessed($_[0]) && overload::Method($_[0], '""'))
defined $_[0]
builtin::reftype($_[0])
builtin::blessed($_[0])
overload::Method($_[0], '""')
Truth table100%5/5
A and B && not(C && D)
A= defined $_[0]B= builtin::reftype($_[0])C= builtin::blessed($_[0])D= overload::Method($_[0], '""')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | && (Scalar::Util::reftype($_[0]) || '') eq "ARRAY" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | && !(Scalar::Util::blessed($_[0]) && overload::Method($_[0], '""')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 54 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||