summaryrefslogtreecommitdiffstats
path: root/Bugzilla/CGI.pm
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2009-11-09 20:15:28 +0100
committermkanat%bugzilla.org <>2009-11-09 20:15:28 +0100
commit4726923228d810ea0cd1800b17a9244c6f0d8eef (patch)
tree2d3fea848aa7e514a56b4f31dcd9453c2deeba77 /Bugzilla/CGI.pm
parenta90df29f99bf1aa3a1835d0aa04e1602e5523096 (diff)
downloadbugzilla-4726923228d810ea0cd1800b17a9244c6f0d8eef.tar.gz
bugzilla-4726923228d810ea0cd1800b17a9244c6f0d8eef.tar.xz
Bug 525734: Allow WebService clients to authenticate using Bugzilla_login and Bugzilla_password
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=dkl, a=mkanat
Diffstat (limited to 'Bugzilla/CGI.pm')
-rw-r--r--Bugzilla/CGI.pm33
1 files changed, 33 insertions, 0 deletions
diff --git a/Bugzilla/CGI.pm b/Bugzilla/CGI.pm
index 8c68f996c..bebff2d63 100644
--- a/Bugzilla/CGI.pm
+++ b/Bugzilla/CGI.pm
@@ -416,6 +416,39 @@ sub url_is_attachment_base {
return ($self->self_url =~ $regex) ? 1 : 0;
}
+##########################
+# Vars TIEHASH Interface #
+##########################
+
+# Fix the TIEHASH interface (scalar $cgi->Vars) to return and accept
+# arrayrefs.
+sub STORE {
+ my $self = shift;
+ my ($param, $value) = @_;
+ if (defined $value and ref $value eq 'ARRAY') {
+ return $self->param(-name => $param, -value => $value);
+ }
+ return $self->SUPER::STORE(@_);
+}
+
+sub FETCH {
+ my ($self, $param) = @_;
+ return $self if $param eq 'CGI'; # CGI.pm did this, so we do too.
+ my @result = $self->param($param);
+ return undef if !scalar(@result);
+ return $result[0] if scalar(@result) == 1;
+ return \@result;
+}
+
+# For the Vars TIEHASH interface: the normal CGI.pm DELETE doesn't return
+# the value deleted, but Perl's "delete" expects that value.
+sub DELETE {
+ my ($self, $param) = @_;
+ my $value = $self->FETCH($param);
+ $self->delete($param);
+ return $value;
+}
+
1;
__END__