BZ-Client
view release on metacpan or search on metacpan
eg/nagios2bugzilla/talktobugzilla.pl view on Meta::CPAN
}
use lib '/usr/lib/nagios/perl'; # OIE::Nagios
use v5.10; # i like 'say'
use BZ::Client;
use BZ::Client::Bug;
use BZ::Client::Bug::Comment;
use BZ::Client::Bugzilla;
use Path::Tiny;
use Try::Tiny; # nb this is slow. see http://perladvent.org/2016/2016-12-12.html
use Sys::Hostname qw/ hostname /;
use Log::Log4perl;
use DateTime;
use Nagios::Cmd; # replace nagios_command
use Data::Dumper;
$Data::Dumper::Indent = 0;
$Data::Dumper::Sortkeys = 0;
# use 0 when debugging, 1 will delete the notice files from spool
my $delete = 1;
lib/BZ/Client/Exception.pm view on Meta::CPAN
Returns the error code from XMLRPC
=head2 http_code
Returns the http code (200, 404, etc)
=head1 EXAMPLE
Here are two examples. The first uses Perl's inbuilt eval() function, the
second uses the Try::Tiny module. Further alternatives exist and may be
perfectly good options if they suit you.
=head2 eval
use BZ::Client;
use BZ::Client::Bug::Attachment;
use v5.10;
my $client = BZ::Client->new( %etc );
lib/BZ/Client/Exception.pm view on Meta::CPAN
my $att = BZ::Client::Bug::Attachment->get($client, { ids => 30505 });
};
if ($@) {
say 'An Error Occured';
say 'Message: ', $@->message();
say 'HTTP Code: ', $@->http_code() if $@->http_code();
say 'XMLrpc Code: ', $@->xmlrpc_code() if $@->xmlrpc_code();
};
=head2 Try::Tiny
use BZ::Client;
use BZ::Client::Bug::Attachment;
use Try::Tiny;
use v5.10;
my $client = BZ::Client->new( %etc );
try {
my $att = BZ::Client::Bug::Attachment->get($client, { ids => 30505 });
}
catch {
say 'An Error Occured';
( run in 0.624 second using v1.01-cache-2.11-cpan-05444aca049 )