]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 385283: bz_webservice_demo.pl --product-name fails (Product.get_product no longer...
authorThorsten Schöning <tschoening@am-soft.de>
Thu, 22 Nov 2012 23:39:37 +0000 (00:39 +0100)
committerFrédéric Buclin <LpSolit@gmail.com>
Thu, 22 Nov 2012 23:39:37 +0000 (00:39 +0100)
Part 2: correctly display components, milestones and versions
r/a=LpSolit

contrib/bz_webservice_demo.pl

index 3ef81489b9350a628a17026736f40a774c401e7d..72ec58a887063e38736b43e97cec1a1edfb659a0 100755 (executable)
@@ -295,16 +295,24 @@ The call will return a C<Bugzilla::Product> object.
 if ($product_name) {
     $soapresult = $proxy->call('Product.get', {'names' => [$product_name]});
     _die_on_fault($soapresult);
-    $result = $soapresult->result;
-
-    if (ref($result) eq 'HASH') {
-        $result = $result->{'products'}->[0];
-        foreach (keys(%$result)) {
-            print "$_: $result->{$_}\n";
+    $result = $soapresult->result()->{'products'}->[0];
+
+    # Iterate all entries, the values may be scalars or array refs with hash refs.
+    foreach my $key (sort(keys %$result)) {
+      my $value = $result->{$key};
+
+      if (ref($value)) {
+        my $counter = 0;
+        foreach my $hash (@$value) {
+          while (my ($innerKey, $innerValue) = each %$hash) {
+            print "$key.$counter.$innerKey: $innerValue\n";
+          }
+          ++$counter;
         }
-    }
-    else {
-        print "$result\n";
+      }
+      else {
+        print "$key: $value\n"
+      }
     }
 }