Net::Google error handling

S

s_p_a_m_mob

Hi there,

Do any of you know how to catch any error from Net::Google (or
underlying SOAP::Lite?). I created a basic script to retrieve files
from Google, and if my internet connexion gets down, I can't catch
neither an exception nor an error code. It just seems to output some
debugging informations...

my $google = Net::Google->new(key=>$key);
my $search = $google->search();
$search->query($query);
$search->max_results(MAXRESULTS);
$search->filter(1);

$results = $search->results(); # that method returns an ARRAY in any
case


Thanks in advance,

Marc-Olivier BERNARD
 
S

s_p_a_m_mob

My poorman solution is to catch and analyse the warnings:

$SIG{__WARN__} = sub {
my $message = join('',@_);
if ($message =~ m/500 Can't connect to api.google.com:80/){
# log message and wait to retry
sleep 180;
}
};
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top