/usr/share/perl5/Debbugs/URI.pm is in libdebbugs-perl 2.6.0.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | # This module is part of debbugs, and is released
# under the terms of the GPL version 2, or any later
# version at your option.
# See the file README and COPYING for more information.
#
# Copyright 2007 by Don Armstrong <don@donarmstrong.com>.
# query_form is
# Copyright 1995-2003 Gisle Aas.
# Copyright 1995 Martijn Koster.
package Debbugs::URI;
=head1 NAME
Debbugs::URI -- Derivative of URI which overrides the query_param
method to use ';' instead of '&' for separators.
=head1 SYNOPSIS
use Debbugs::URI;
=head1 DESCRIPTION
See L<URI> for more information.
=head1 BUGS
None known.
=cut
use warnings;
use strict;
use base qw(URI URI::_query);
=head2 query_param
$uri->query_form( $key1 => $val1, $key2 => $val2, ... )
Exactly like query_param in L<URI> except query elements are joined by
; instead of &.
=cut
{
package URI::_query;
no warnings 'redefine';
# Handle ...?foo=bar&bar=foo type of query
sub URI::_query::query_form {
my $self = shift;
my $old = $self->query;
if (@_) {
# Try to set query string
my @new = @_;
if (@new == 1) {
my $n = $new[0];
if (ref($n) eq "ARRAY") {
@new = @$n;
}
elsif (ref($n) eq "HASH") {
@new = %$n;
}
}
my @query;
while (my($key,$vals) = splice(@new, 0, 2)) {
$key = '' unless defined $key;
$key =~ s/([;\/?:@&=+,\$\[\]%])/$URI::Escape::escapes{$1}/g;
$key =~ s/ /+/g;
$vals = [ref($vals) eq "ARRAY" ? @$vals : $vals];
for my $val (@$vals) {
$val = '' unless defined $val;
$val =~ s/([;\/?:@&=+,\$\[\]%])/$URI::Escape::escapes{$1}/g;
$val =~ s/ /+/g;
push(@query, "$key=$val");
}
}
# We've changed & to a ; here.
$self->query(@query ? join(';', @query) : undef);
}
return if !defined($old) || !length($old) || !defined(wantarray);
return unless $old =~ /=/; # not a form
map { s/\+/ /g; uri_unescape($_) }
# We've also changed the split here to split on ; as well as &
map { /=/ ? split(/=/, $_, 2) : ($_ => '')} split(/[&;]/, $old);
}
}
1;
__END__
|