]> git.donarmstrong.com Git - debbugs.git/commitdiff
handle single options in Debbugs::SOAP correctly
authorDon Armstrong <don@donarmstrong.com>
Fri, 22 Jun 2007 19:42:58 +0000 (20:42 +0100)
committerDon Armstrong <don@donarmstrong.com>
Fri, 22 Jun 2007 19:42:58 +0000 (20:42 +0100)
Debbugs/SOAP.pm

index 7ab55e2b04255561f089b0a2061385b4303f818c..2d8306c0b30251e4d1dfd6e0d141b05ad04c7527 100644 (file)
@@ -119,9 +119,18 @@ sub get_bugs{
      my $VERSION = __populate_version(pop);
      my ($self,@params) = @_;
      my %params;
+     # Because some clients can't handle passing arrayrefs, we allow
+     # options to be specified multiple times
      while (my ($key,$value) = splice @params,0,2) {
          push @{$params{$key}}, make_list($value);
      }
+     # However, for singly specified options, we want to pull them
+     # back out
+     for my $key (keys %params) {
+         if (@{$params{$key}} == 1) {
+              ($params{$key}) = @{$params{key}}
+         }
+     }
      my @bugs;
      @bugs = Debbugs::Bugs::get_bugs(%params);
      return \@bugs;