CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Bugzilla webservice perl script

 



igorza
New User

Apr 17, 2013, 11:52 AM

Post #1 of 5 (416 views)
Bugzilla webservice perl script Can't Post

I am trying to use bz_webservice_demo.pl script to get release notes from bugzilla. I have received bugs with description, product, status ..., but bugs are not sorted by product name. How to edit this part (or script):

if ($bug_id) {
$soapresult = $proxy->call('Bug.get', { ids => [$bug_id] });
_die_on_fault($soapresult);
$result = $soapresult->result;
my $bug = $result->{bugs}->[0];
foreach my $field (keys(%$bug)) {
my $value = $bug->{$field};
if (ref($value) eq 'HASH') {
foreach (keys %$value) {
print "$_: " . $value->{$_} . "\n";
}
}
else {
print "$field: $value\n";
}
}
}

to sort bugs by product name?

Or maybe solution for listing bugs for selected product.

Script is on:
https://github.com/flz/bugzilla-migrator/blob/master/contrib/bz_webservice_demo.pl


Thanks,
Igor


FishMonger
Veteran / Moderator

Apr 17, 2013, 12:05 PM

Post #2 of 5 (414 views)
Re: [igorza] Bugzilla webservice perl script [In reply to] Can't Post

Why haven't you responded to my post, which was 4 hours ago, on your cross post at devshed?

http://forums.devshed.com/perl-programming-6/bugzilla-webservice-perl-script-943723.html


igorza
New User

Apr 17, 2013, 12:14 PM

Post #3 of 5 (411 views)
Re: [FishMonger] Bugzilla webservice perl script [In reply to] Can't Post

Sorry, I haven't seen your post.
Thanks for your answer.
I add sort to both foreach loop initializations, but bugs are not sorted by "product". Maybe beter solution for me is to get bugs only for specified product.
Thanks


igorza
New User

Apr 17, 2013, 1:55 PM

Post #4 of 5 (409 views)
Re: [igorza] Bugzilla webservice perl script [In reply to] Can't Post

Maybe will better to describe with example:

I got:

Bug: 138
Description: correction in httpd.conf
Product: A
Status: Fixed


Bug: 206
Description: ssl doesn’t work
Product: F
Status: Solved


Bug: 200
Description: port closed
Product: B
Status: Fixed


Bug: 211
Description: apache problem
Product: F
Status: Solved



I need:

Bug: 138
Description: correction in httpd.conf
Product: A
Status: Fixed


Bug: 200
Description: port closed
Product: B
Status: Fixed


Bug: 206
Description: ssl doesn’t work
Product: F
Status: Solved


Bug: 211
Description: apache problem
Product: F
Status: Solved

Sorted by Product (A, B, F, F)


Or show me only bugs where Product==F

Bug: 206
Description: ssl doesn’t work
Product: F
Status: Solved


Bug: 211
Description: apache problem
Product: F
Status: Solved


(This post was edited by igorza on Apr 17, 2013, 1:57 PM)


FishMonger
Veteran / Moderator

Apr 17, 2013, 4:34 PM

Post #5 of 5 (400 views)
Re: [igorza] Bugzilla webservice perl script [In reply to] Can't Post

Based on that output the exact structure of the hash is not clear.

Could you post the dumped version.

i.e., adjust the block to this and post the output.


Code
use Data::Dumper; # place this line with the other use statements 

if ($bug_id) {
$soapresult = $proxy->call('Bug.get', { ids => [$bug_id] });
_die_on_fault($soapresult);
$result = $soapresult->result;
my $bug = $result->{bugs}->[0];

print Dumper $bug;

foreach my $field ( sort keys %$bug) {
my $value = $bug->{$field};
if (ref($value) eq 'HASH') {
foreach (sort keys %$value) {
print "$_: " . $value->{$_} . "\n";
}
}
else {
print "$field: $value\n";
}
}
}


With that dumper output I will be able to work out the sorting.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives