Net::Google error handling

Discussion in 'Perl Misc' started by s_p_a_m_mob@hotmail.com, Mar 7, 2005.

  1. Guest

    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
     
    , Mar 7, 2005
    #1
    1. Advertising

  2. Guest

    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;
    }
    };
     
    , Mar 7, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrew Thompson

    FAQ - references to Google/Google Groups

    Andrew Thompson, Jun 20, 2005, in forum: Java
    Replies:
    0
    Views:
    629
    Andrew Thompson
    Jun 20, 2005
  2. Replies:
    2
    Views:
    2,036
    Jeffrey Schwab
    Nov 28, 2005
  3. Krice
    Replies:
    9
    Views:
    295
    Default User
    Apr 25, 2008
  4. JSH
    Replies:
    0
    Views:
    377
  5. Ethan Herdrick
    Replies:
    1
    Views:
    109
    Ethan Herdrick
    May 11, 2006
Loading...

Share This Page