5 Debbugs::URI -- Derivative of URI which overrides the query_param
6 method to use ';' instead of '&' for separators.
14 See L<URI> for more information.
24 use base qw(URI URI::_query);
28 $uri->query_form( $key1 => $val1, $key2 => $val2, ... )
30 Exactly like query_param in L<URI> except query elements are joined by
39 no warnings 'redefine';
40 # Handle ...?foo=bar&bar=foo type of query
41 sub URI::_query::query_form {
43 my $old = $self->query;
45 # Try to set query string
49 if (ref($n) eq "ARRAY") {
52 elsif (ref($n) eq "HASH") {
57 while (my($key,$vals) = splice(@new, 0, 2)) {
58 $key = '' unless defined $key;
59 $key =~ s/([;\/?:@&=+,\$\[\]%])/$URI::Escape::escapes{$1}/g;
61 $vals = [ref($vals) eq "ARRAY" ? @$vals : $vals];
62 for my $val (@$vals) {
63 $val = '' unless defined $val;
64 $val =~ s/([;\/?:@&=+,\$\[\]%])/$URI::Escape::escapes{$1}/g;
66 push(@query, "$key=$val");
69 # We've changed & to a ; here.
70 $self->query(@query ? join(';', @query) : undef);
72 return if !defined($old) || !length($old) || !defined(wantarray);
73 return unless $old =~ /=/; # not a form
74 map { s/\+/ /g; uri_unescape($_) }
75 # We've also changed the split here to split on ; as well as &
76 map { /=/ ? split(/=/, $_, 2) : ($_ => '')} split(/[&;]/, $old);