summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xcontrib/bz_webservice_demo.pl26
1 files changed, 17 insertions, 9 deletions
diff --git a/contrib/bz_webservice_demo.pl b/contrib/bz_webservice_demo.pl
index 3ef81489b..72ec58a88 100755
--- a/contrib/bz_webservice_demo.pl
+++ b/contrib/bz_webservice_demo.pl
@@ -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"
+ }
}
}