Skip Menu |
 

This queue is for tickets about the BZ-Client CPAN distribution.

Report information
The Basics
Id: 91405
Status: resolved
Priority: 0/
Queue: BZ-Client

People
Owner: Nobody in particular
Requestors: samip.banker [...] ti.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Getting "BZ::Client::Exception=HASH(0x5343560)"
Date: Fri, 13 Dec 2013 20:25:39 +0000
To: "bug-BZ-Client [...] rt.cpan.org" <bug-BZ-Client [...] rt.cpan.org>
From: "Banker, Samip" <samip.banker [...] ti.com>
Download (untitled) / with headers
text/plain 1.3k
Hello: I am getting this error "BZ::Client::Exception=HASH(0x5343560)" and not sure what is the actual error so I can try to fix it. My env is ð OS = Windows 7 ð Perl = 5.16.3 ð BZ::Client = 1.04 ð BZ : 4.2.4 I get the exception when "$client->login();" code is executed... Please help. Below is sample of the code... ****************************** #!/usr/bin/perl -w use strict; use BZ::Client; use BZ::Client::Bug; use BZ::Client::Product; use BZ::Client::Bugzilla; use BZ::Client::Exception; use BZ::Client::API(); my $url = "http://localhost:90/"; my $user = "user"; my $password = "password"; my $err = ""; my $client = BZ::Client->new("url" => $url, "user" => $user, "password" => $password); $client->logDirectory("C:/bzSynclog"); print $client->is_logged_in(); $client->login(); my $exception = BZ::Client::Bug->get($client, '8'); ****************************** Best Regards, *************************************************** _ Samip K. Banker _| TI Software Development Organization, \. _} Solution Architect (Quality Assurance / CM) \( Texas Instruments, Inc. Support : pfo-tg@list.ti.com<mailto:pfo-tg@list.ti.com> (for OMAP Infrastructure) Work: (214)567 - 7646 Cell: (469)360 - 2064 Linked-in: http://lnkd.in/yKchj4 ***************************************************
Download (untitled) / with headers
text/plain 2.3k
You should do something like this: use Try::Tiny; .. (etc) .. try { my $bug = BZ::Client::Bug->get($client, '8'); } catch { my $reason = 'Failed. Message: ' . $_->message(); $reason .= ' XML code: ' . $_->xmlrpc_code() if $_->xmlrpc_code; $reason .= ' HTTP code: ' . $_->http_code() if $_->http_code; die $reason } Alternatively you can use perls in-built eval{} rather than Try::Tiny. Whatever suits your tastes. Also if you are lazy, as all good perl programmers are. You can just use Data::Dumper to dump the exception object rather than fussing about with the object methods. This has good whipupitude qualities although is a little rough as a final error output message for a novice end user. e.g. use Data::Dumper; eval { my $bug = BZ::Client::Bug->get($client, '8'); }; if ($@) { die 'Error: ' . Dumper( $@ ) } On Fri Dec 13 15:25:52 2013, samip.banker@ti.com wrote: Show quoted text
> Hello: > > I am getting this error "BZ::Client::Exception=HASH(0x5343560)" and > not sure what is the actual error so I can try to fix it. > My env is > > ð OS = Windows 7 > > ð Perl = 5.16.3 > > ð BZ::Client = 1.04 > > ð BZ : 4.2.4 > > I get the exception when "$client->login();" code is executed... > Please help. > > Below is sample of the code... > ****************************** > #!/usr/bin/perl -w > use strict; > use BZ::Client; > use BZ::Client::Bug; > use BZ::Client::Product; > use BZ::Client::Bugzilla; > use BZ::Client::Exception; > use BZ::Client::API(); > > my $url = "http://localhost:90/"; > my $user = "user"; > my $password = "password"; > my $err = ""; > > > my $client = BZ::Client->new("url" => $url, > "user" => $user, > "password" => $password); > > $client->logDirectory("C:/bzSynclog"); > > print $client->is_logged_in(); > $client->login(); > > my $exception = BZ::Client::Bug->get($client, '8'); > > ****************************** > > > > > > > > > Best Regards, > *************************************************** > _ Samip K. Banker > _| TI Software Development Organization, > \. _} Solution Architect (Quality Assurance / CM) > \( Texas Instruments, Inc. > Support : pfo-tg@list.ti.com<mailto:pfo-tg@list.ti.com> (for OMAP > Infrastructure) > Work: (214)567 - 7646 > Cell: (469)360 - 2064 > Linked-in: http://lnkd.in/yKchj4 > ***************************************************
Download (untitled) / with headers
text/plain 2.6k
At some point in the near future i will add this to the pod On Wed Sep 23 23:11:21 2015, djzort wrote: Show quoted text
> You should do something like this: > > use Try::Tiny; > .. (etc) .. > > try { > my $bug = BZ::Client::Bug->get($client, '8'); > } > catch { > my $reason = 'Failed. Message: ' . $_->message(); > $reason .= ' XML code: ' . $_->xmlrpc_code() if $_->xmlrpc_code; > $reason .= ' HTTP code: ' . $_->http_code() if $_->http_code; > die $reason > } > > > Alternatively you can use perls in-built eval{} rather than Try::Tiny. > Whatever suits your tastes. > > Also if you are lazy, as all good perl programmers are. You can just > use Data::Dumper to dump the exception object rather than fussing > about with the object methods. This has good whipupitude qualities > although is a little rough as a final error output message for a > novice end user. > > e.g. > > use Data::Dumper; > > eval { > my $bug = BZ::Client::Bug->get($client, '8'); > }; > if ($@) { > die 'Error: ' . Dumper( $@ ) > } > > > > > On Fri Dec 13 15:25:52 2013, samip.banker@ti.com wrote:
> > Hello: > > > > I am getting this error "BZ::Client::Exception=HASH(0x5343560)" and > > not sure what is the actual error so I can try to fix it. > > My env is > > > > ð OS = Windows 7 > > > > ð Perl = 5.16.3 > > > > ð BZ::Client = 1.04 > > > > ð BZ : 4.2.4 > > > > I get the exception when "$client->login();" code is executed... > > Please help. > > > > Below is sample of the code... > > ****************************** > > #!/usr/bin/perl -w > > use strict; > > use BZ::Client; > > use BZ::Client::Bug; > > use BZ::Client::Product; > > use BZ::Client::Bugzilla; > > use BZ::Client::Exception; > > use BZ::Client::API(); > > > > my $url = "http://localhost:90/"; > > my $user = "user"; > > my $password = "password"; > > my $err = ""; > > > > > > my $client = BZ::Client->new("url" => $url, > > "user" => $user, > > "password" => $password); > > > > $client->logDirectory("C:/bzSynclog"); > > > > print $client->is_logged_in(); > > $client->login(); > > > > my $exception = BZ::Client::Bug->get($client, '8'); > > > > ****************************** > > > > > > > > > > > > > > > > > > Best Regards, > > *************************************************** > > _ Samip K. Banker > > _| TI Software Development Organization, > > \. _} Solution Architect (Quality Assurance / CM) > > \( Texas Instruments, Inc. > > Support : pfo-tg@list.ti.com<mailto:pfo-tg@list.ti.com> (for > > OMAP > > Infrastructure) > > Work: (214)567 - 7646 > > Cell: (469)360 - 2064 > > Linked-in: http://lnkd.in/yKchj4 > > ***************************************************
This is now covered in the pod for BZ::Client::Exception in release 4.4


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.