in reply to Re: Using LWP::Parallel
in thread Using LWP::Parallel

Actually, it's quite trivial to get the POE solution to fetch 10 documents at a time; you just create 10 sessions which continually (get a URL off a master list, then fetch that document).

Replies are listed 'Best First'.
Re: Re: Re: Using LWP::Parallel
by hossman (Prior) on Mar 11, 2002 at 20:33 UTC
    I wouldn't call it trivial if people have no experience with POE. I for one didn't understand from your example how you were suggesting it would help him towards his goal of retrieving no more then 10 at a time.

    After reading the POE, POE::Session, & POE::Component::Client::UserAgent I *think* what you're suggesting is that the poster modifying 02multi.t so that this...

    POE::Session -> create ( inline_states => { _start => \&_start, _stop => \&_stop, response => \&response, _signal => \&_signal }, );
    becomes this...
    for (my $i = 0; $i < 10; $i++) { POE::Session -> create ( inline_states => { _start => \&_start, _stop => \&_stop, response => \&response, _signal => \&_signal }, ); }
    and change _start to only loop over a 1/10 of @urls.

    Does that sound about right?

    Frankly, i'm still not clear on why this can't be done in a more straight forward manner with LWP::Parallel directly, It has the functionality to limit the number of parrallel requests to an individual server -- OR to limit the number of different servers it sends requests to at the same time, ... why isn't there a more general way to limit the TOTAL number of parrallel requests?

      Frankly, i'm still not clear on why this can't be done in a more straight forward manner with LWP::Parallel directly, ...

      Well, for a start you can't do anything while the fetch is happening.

      I've written a little script that keeps 10 threads; it's in my original post. As you can see, there's not much to it.

      (Event-based programming)++