From 569fdbba8b711b7cbd13effc825265220d5a53c5 Mon Sep 17 00:00:00 2001 From: Thorsten Schöning Date: Tue, 20 Nov 2012 17:50:17 +0100 Subject: Bug 385283: bz_webservice_demo.pl --product-name fails (Product.get_product no longer exists) r/a=LpSolit --- contrib/bz_webservice_demo.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'contrib') diff --git a/contrib/bz_webservice_demo.pl b/contrib/bz_webservice_demo.pl index 104151d85..3ef81489b 100755 --- a/contrib/bz_webservice_demo.pl +++ b/contrib/bz_webservice_demo.pl @@ -287,20 +287,20 @@ if ($bug_id) { =head2 Retrieving Product Information -Call C with the name of the product you want to know more -of. +Call C with the name of the product you want to know more of. The call will return a C object. =cut if ($product_name) { - $soapresult = $proxy->call('Product.get_product', $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"; + print "$_: $result->{$_}\n"; } } else { -- cgit v1.2.3-24-g4f1b From 7353bc8fce1eaed8fa0bba03dcef157eafaf8a42 Mon Sep 17 00:00:00 2001 From: Thorsten Schöning Date: Fri, 23 Nov 2012 00:39:37 +0100 Subject: Bug 385283: bz_webservice_demo.pl --product-name fails (Product.get_product no longer exists) Part 2: correctly display components, milestones and versions r/a=LpSolit --- contrib/bz_webservice_demo.pl | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'contrib') 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 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" + } } } -- cgit v1.2.3-24-g4f1b