#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    1
    Rep Power
    0

    Bugzilla webservice perl script


    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?

    Thanks,
    Igor
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,970
    Rep Power
    1225
    Please use the code tags.

    Add the sort to both foreach loop initializations.

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

IMN logo majestic logo threadwatch logo seochat tools logo