Skip to content

Instantly share code, notes, and snippets.

@globau
Created January 3, 2013 06:00
Show Gist options
  • Save globau/4441163 to your computer and use it in GitHub Desktop.
Save globau/4441163 to your computer and use it in GitHub Desktop.
bugzilla xmlrpc testing script
#!/usr/bin/perl
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
use strict;
use warnings;
use HTTP::Cookies;
use XMLRPC::Lite;
use Data::Dumper;
$Data::Dumper::Terse = 1;
$Data::Dumper::Sortkeys = 1;
bugzilla(
'User.login', {
login => 'you@example.com',
password => 'secret',
remember => 1,
});
print Dumper(
bugzilla(
'Bug.history', {
ids => [ 686335 ],
}
));
#
# helpers
#
my $_bugzilla;
sub bugzilla {
my ($method, $params) = @_;
$_bugzilla ||= XMLRPC::Lite->proxy(
'https://bugzilla.allizom.org/xmlrpc.cgi',
'cookie_jar' => HTTP::Cookies->new);
my $soapresult = $_bugzilla->call($method, $params);
if ($soapresult->fault) {
my ($package, $filename, $line) = caller;
die $soapresult->faultcode . ' ' . $soapresult->faultstring .
" in SOAP call near $filename line $line.\n";
}
return $soapresult->result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment