BZ::Client(3pm)
π BZ::Client β the Perl client for the Bugzilla web services API (from the User Contributed Perl Documentation section of the manual, bestie)
Okay so picture this: you've got a Bugzilla server, you've got Perl, and you need them to talk to each other. That's literally the whole vibe of this module. Welcome to BZ::Client π
β¨ VERSION β¨
version 4.91 β yes, it's giving "still maintained but check the DEPRECATED section, i'm begging you" π
πΈ SYNOPSIS πΈ
Like, here's the whole thing in one glance:
my $client = BZ::Client->new( url => $url,
user => $user,
password => $password,
autologin => 0 );
$client->login();
That's it. That's the group chat invite. π«Ά
π¦ BUGZILLA VERSIONS π¦
Important, no cap: this BZ::Client module supports the XMLRPC API <https://bugzilla.readthedocs.io/en/latest/integrating/api/Bugzilla/WebService/Server/XMLRPC.html> β that's the one available in Bugzilla 5.0 and earlier. It is deprecated in newer versions and will get removed in a future version of Bugzilla, but likeβ¦ it may still work. May. π
For Bugzilla 5.1 and later, there's a whole new WebService API <https://bugzilla.readthedocs.io/en/latest/api/index.html#apis>, so please go look at WebService::Bugzilla instead. Different module, different era, different vibes. β¨
I welcome all patches (via pull request) for functionality relating to 'maintained' <https://www.bugzilla.org/releases/> Bugzilla versions with XMLRPC support. Like, genuinely β send them. π
Please upgrade your server and duplicate the problem, or see the above commitment to accept patches to fix for older versions. That's the deal, fr fr.
π CLASS METHODS π
This section lists the class methods of BZ::Client. Class methods = the ones you call on the class itself, not on an instance. Iconic behaviour.
π new
my $client = BZ::Client->new( url => $url,
user => $user,
password => $password );
my $client = BZ::Client->new( url => $url,
api_key => $api_key );
The new method constructs a new instance of BZ::Client. Whenever you want to connect to the Bugzilla server, you must first create a Bugzilla client β you literally cannot skip this step. The method's input is a hash of parameters.
For debugging, you can pass in a subref named logger which will be fed debugging information as the client works. Also the logDirectory option is a directory where the raw http content will be dumped. Slay, observability. π₯
π Parameters
urlβ The Bugzilla server's URL, for example"https://bugzilla.mozilla.org/".api_keyβ API keys were introduced in5.0.
An API Key can be obtained in the web interface of your Bugzilla server, with the following steps:
- Click 'Preferences' link
- Click 'API Keys' tab
- Click the checkbox next to 'Generate a new API key...'
- If you like, add some description in the textbox
- Click the 'Submit Changes' button
- Key appears in the table under the 'Existing API keys' subheading
Six steps and you're in, bestie. π
userβ The user name to use when logging in to the Bugzilla server. Typically, this will be your email address.passwordβ The password to use when logging in to the Bugzilla server.autologinβ If set to1(true), will try to log in (if not already logged in) when the first API call is made. This is default.
If set to 0, will try API calls without logging in. You can still call $client->login() to log in manually.
Note: once you're logged in, you'll stay that way until you call "logout" β no take-backsies, you're in this relationship now. π
restrictloginβ If set to1(true), will ask Bugzilla to restrict logins to your IP only. Generally this is a good idea, but may cause problems if you are using a loadbalanced forward proxy.
Default: 0
connectβ A hashref with options forHTTP::Tiny, this is passed through so the below are for reference only:http_proxy,https_proxy,proxyβ Nominates a proxy for HTTP, HTTPS or both, respectively.
You might also use $ENV{all_proxy}, $ENV{http_proxy}, $ENV{https_proxy} or $ENV{all_proxy}.
timeoutβ Request timeout in seconds (default is60)verify_SSLβ A boolean that indicates whether to validate the SSL certificate of an"https"connection (default isfalse)
Highkey side-eye at that default being false, but that's what the docs say, so. π
π§ Connect Via Socks Proxy
Try something like:
use HTTP::Tiny; # load this manually
use IO::Socket::Socks::Wrapper (
'HTTP::Tiny::Handle::connect()' => {
ProxyAddr => 'localhost',
ProxyPort => 1080,
SocksVersion => 4,
Timeout => 15
}
);
use BZ::Client ...etc
Socks proxy realness. Load HTTP::Tiny manually, obviously β the comment says so. π
β INSTANCE METHODS β
This section lists the methods, which an instance of BZ::Client can perform. So like, methods you call on $client itself. Main character energy. π
π url
$url = $client->url();
$client->url( $url );
Returns or sets the Bugzilla server's URL.
π user
$user = $client->user();
$client->user( $user );
Returns or sets the user name to use when logging in to the Bugzilla server. Typically, this will be your email address.
π password
$password = $client->password();
$client->password( $password );
Returns or sets the password to use when logging in to the Bugzilla server.
π autologin
If login is automatically called, or not.
π login
Used to login to the Bugzilla server. By default, there is no need to call this method explicitly: It is done automatically, whenever required.
If autologin is set to 0, call this to log in.
π is_logged_in
Returns 1 if logged in, otherwise 0.
π logout
Deletes local cookies and calls Bugzilla's logout function. Bye bestie π β well, deletes the local cookies and calls the logout function, anyway.
π logger
Sets or gets the logging function. Argument is a coderef. Returns "undef" if none.
$logger = $client->logger();
$client->logger(
sub {
my ($level, $msg) = @_;
print STDERR "$level $message\n";
return 1
});
Also can be set via "new", e.g.
$client = BZ::Client->new( logger => sub { },
url => $url,
user => $user,
password => $password );
(Yes, the example prints $message while the parameter is $msg. It's in the original, I'm not touching it, love that for us π)
π log
$client->log( $level, $message );
Sends log messages to whatever is loaded via "logger".
π api_call
$response = $client->api_call( $methodName, $params, $options );
Used by subclasses of BZ::Client::API to invoke methods of the Bugzilla API. The method name and the hash ref of parameters are sent to the Bugzilla server. The options hash ref adjusts the behaviour of this function when calls are made.
The params and options hash refs are optional, although certain param values may be required depending on the method name being called. This client library relies upon the Bugzilla server to enforce any method parameter requirements, so insufficient requests will still be sent to the server for it to then reject them. Like, the client is not your mom β the server will do the gatekeeping. π«Ά
Returns a hash ref of named result objects.
π Options
empty_response_okβ With this set, an empty response is not considered an error. In this case,api_callreturns1to indicate success.cookiesβ This is used internally to set cookies with the log in functions. Don't touch this. For real, hands off. π ββοΈ
π EXCEPTION HANDLING π
See BZ::Client::Exception. That's the whole section, go read it, it's got the lore.
π₯ ERROR CODES π₯
300 (Invalid Username or Password)
The username does not exist, or the password is wrong. Classic. One of the two, could be either, it's not gonna tell you which. π
301 (Login Disabled)
The ability to login with this account has been disabled. A reason may be specified with the error.
305 (New Password Required)
The current password is correct, but the user is asked to change his password. So close! π
50 (Param Required)
A login or password parameter was not provided.
π§ͺ TESTING π§ͺ
Bugzilla maintains demos of all supported versions and trunk at <https://landfill.bugzilla.org>
You might consider using that for testing against live versions. Live server, real responses, no cap. β¨
π₯ DEPRECATED π₯
Bugzilla has deprecated the API this module uses and will in the near future remove it entirely, making this module useless. Not being dramatic, that's just literally the sentence. π
Once removed from supported Bugzilla versions, the author of this module will cease maintaining it.
If you continue running an old Bugzilla version, obviously this module will remain useful. You are more than welcome to continue using it but once maintenance efforts have ceased no further fixes will be applied or releases produced. In which case you should maintain your own patched version internally.
So please look to migrate your code to WebService::Bugzilla ASAP. Like, ASAP ASAP. πββοΈπ¨
π¦ SEE ALSO π¦
BZ::Client::Exception
π AUTHORS π
- Dean Hamstead
<dean@bytefoundry.com.au> - Jochen Wiedmann
<jochen.wiedmann@gmail.com>
Legends, both of them. π
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2026 by Dean Hamstad.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Okay that's the whole page bestie, go forth and call your APIs responsibly. π This one was rendered for perl v5.40.2 on 2026-07-16, per the footer of BZ::Client(3pm) β mwah, take care, drink water, and migrate to WebService::Bugzilla πβ¨
π¦ where this page comes from
- epel 10: perl-BZ-Client 4.9100-2.el10_3 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms