in reply to Re: Re (tilly) 3: Parallel Downloads using Parallel::ForkManager or whatever works!!!
in thread Parallel Downloads using Parallel::ForkManager or whatever works!!!
In short, treat your message as the start of an attempted conversation. Assume that between your initial asking and your understanding there may be a couple of rounds of discussion.
In this case I cannot check this code because I don't have the necessary module. But try the following example based on the documentation:
Note the use of strict.pm and a consistent indentation style. Those are both excellent habits that will save you a lot of grief in the long run...use strict; use LWP::Simple; use Parallel::ForkManager; # I assume you have reasons for a hash later..? my %urls = ( 'drudge' => 'http://www.drudgereport.com', 'rush' => 'http://www.rushlimbaugh.com/home/today.guest.html', 'yahoo' => 'http://www.yahoo.com', 'cds' => 'http://www.cdsllc.com/', ); my $pm = new Parallel::ForkManager(30); foreach my $file (sort keys %urls) { $pm->start and next; # do the fork # Start child code. my $ret = getstore($url{$file}, $file); print "File '$file' stored url '$url' with response code '$ret'\n"; # End child code. $pm->finish(); } $pm->wait_all_children;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re (tilly) 5: Parallel Downloads using Parallel::ForkManager or whatever works!!!
by jamesluc (Novice) on Jan 09, 2002 at 02:50 UTC | |
by tilly (Archbishop) on Jan 09, 2002 at 14:54 UTC | |
by jamesluc (Novice) on Jan 09, 2002 at 19:53 UTC |