LWP::Parallel how to process results

Discussion in 'Perl Misc' started by John Bokma, Jun 16, 2005.

  1. John Bokma

    John Bokma Guest

    Hi,

    I am using LWP::parallel::UserAgent

    I register requests, and $pua->wait() returns a hash ref, the keys are the
    stringified registered requests (HTTP::Requests).

    Since I want each result to have it's own handler, I currently make a look
    up table (hash) with stringified request object ref as key and a ref to a
    sub as value, and do something like:

    for my $key ( keys %$entries ) {

    my $response = $entries->{$key}->response;

    my $callback = $key2callback{ $key };
    $callback->( $response->content );
    }

    Is there a more clean approach?

    --
    John Small Perl scripts: http://johnbokma.com/perl/
    Perl programmer available: http://castleamber.com/
    Happy Customers: http://castleamber.com/testimonials.html
     
    John Bokma, Jun 16, 2005
    #1
    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. Replies:
    0
    Views:
    529
  2. Zeke Koos
    Replies:
    0
    Views:
    200
    Zeke Koos
    Sep 15, 2003
  3. Zeke Koos
    Replies:
    0
    Views:
    91
    Zeke Koos
    Sep 16, 2003
  4. Alex
    Replies:
    0
    Views:
    209
  5. Leif Wessman
    Replies:
    0
    Views:
    93
    Leif Wessman
    Jun 16, 2004
Loading...

Share This Page