http://www.perlmonks.org/?node_id=892166

Goggle is your friend.

On Thu, Sep 10, 2015 at 1:54 AM, Jitendra B <jiten...@gmail.com> wrote:

> Dear Sir/Madam,
>
> while I try to connect and query some data from bugzilla, I am getting
> following error.
>
> Error:
>
> RPC::XML::Client::send_request: HTTP server error: Can't verify SSL peers
> without knowing which Certificate Authorities to trust at
> /Library/Perl/5.18/RPC/XML/Client.pm line 416.
>
>
> Script:
>
>
> #!/usr/bin/perl
>
> use strict;
>
> use vars qw($VERSION);
>
> use LEOCHARRE::CLI2 ':all','u:p:s:';
>
> use LEOCHARRE::Dir ':all';
>
> $VERSION = sprintf "%d.%02d", q$Revision: 1.3 $ =~ /(\d+)/g;
>
> use WWW::Bugzilla3;
>
> use Net::SSL;
>
> use Smart::Comments '###';
>
>
> $opt_u or die("Missing username");
>
> $opt_p or die("Missing password");
>
> $opt_s or die("Missing site");
>
>
> my $b = WWW::Bugzilla3->new( site => $opt_s );
>
> my $r = $b->login( $opt_u, $opt_p ) or die("Could not login");
>
> ### $r
>
>
> my @pids = $b->get_selectable_products(); # product ids
>
> ### product ids: @pids
>
> # get descriptive.. hashes..
>
>
> my %product;
>
> for (@pids){
>
>    my $p = ($b->get_products($_))[0];
>
>    $product{$_} = $p;
>
> }
>
> ### %product
>
> my @all_bugs = $b->search;
>
> ### @all_bugs;
>
> my $count = scalar @all_bugs;
>
> warn("Have $count bugs");
>
> $count or exit;
>
> my @bugs = $b->get_bugs( @all_bugs ); # bug ids
>
> ## @bugs
>
> #my $c = scalar @bugs;
>
> #($c == 1) or warn("Got $c bugs in id $id, expected 1 only?");
>
> # get_bugs is weird
>
> BUG: for my $bug ( @bugs ){
>
>    $bug->{internals}->{resolution} ||= 'OPEN';
>
>    $bug->{internals}->{resolution}=~/INVALID|DUPLICATE/ and next BUG;
>
>    # example return for $bug
>
>
>
> ##       {
>
> ##            alias => '',
>
> ##            creation_time => '20090623T15:34:00',
>
> ##            id => '15',
>
> ##            internals => {
>
> ##                           alias => '',
>
> ##                           assigned_to => '1',
>
> ##                           bug_file_loc => '',
>
> ##                           bug_id => '15',
>
> ##                           bug_severity => 'enhancement',
>
> ##                           bug_status => 'RESOLVED',
>
> ##                           cclist_accessible => '1',
>
> ##                           cf_web_browser => '---',
>
> ##                           component_id => '4',
>
> ##                           creation_ts => '2009.06.23 15:34',
>
> ##                           delta_ts => '2009-06-23 15:55:39',
>
> ##                           everconfirmed => '1',
>
> ##                           op_sys => 'All',
>
> ##                           priority => 'P5',
>
> ##                           product_id => '3',
>
> ##                           qa_contact => '',
>
> ##                           rep_platform => 'All',
>
> ##                           reporter_accessible => '1',
>
> ##                           reporter_id => '1',
>
> ##                           resolution => 'FIXED',
>
> ##                           short_desc => 'branding all the clients in
> the dms',
>
> ##                           status_whiteboard => '',
>
> ##                           target_milestone => '---',
>
> ##                           version => 'DMS2'
>
> ##                         },
>
> ##            last_change_time => '20090623T15:55:39',
>
> ##            summary => 'branding all the clients in the dms'
>
> ##          }
>
> ##        ]
>
>    printf "---
>
> title: %s
>
> id: %0.3d
>
> product: %s
>
> status: %s
>
>
> ",
>
>       $bug->{summary},
>
>       $bug->{id},
>
>       $product{ $bug->{internals}->{product_id} }->{name},
>
>       ( $bug->{internals}->{resolution} || 'OPEN'),
>
>
>
>    ;
>
>
>
> }
>
>
> exit;
>
> sub usage {
>
>    qq{$0 [OPTION]..
>
> Show bugzilla summary for bureaucracy.
>
>
>    -d          debug
>
>    -h          help
>
>    -v          version
>
>    -p string   password
>
>    -u string   username
>
>    -s string   url of bugzilla website
>
>
> Example Usage:
>
>
>    $0 -u jbarik -p hahaha -s https://bugzilla.mysite.com/
>
>
> }}
>
>

Reply via email to