in reply to Re^3: Parallel downloading under Win32?
in thread Parallel downloading under Win32?
</readmoresub fetch_xml_data { my ($ids) = @_; my $dir = 'quicklook/'; my $url = 'http://api.eve-central.com/api/quicklook?typeid='; my $thread_count = 20; my $Q = new Thread::Queue; my @threads; for my $id (@{ $ids }) { $Q->enqueue( $id ); } for ( 1 .. $thread_count ) { push @threads, threads->create( sub { require LWP::Simple; while( my $id = $Q->dequeue ) { say "Downloading XML file for id $id.<br>"; LWP::Simple::getstore( $url.$id, $dir.$id ); } } ); $Q->enqueue( undef ); } $_->join for @threads; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Parallel downloading under Win32?
by BrowserUk (Patriarch) on Apr 30, 2009 at 02:17 UTC | |
by Xenofur (Monk) on Apr 30, 2009 at 09:30 UTC | |
by BrowserUk (Patriarch) on Apr 30, 2009 at 09:44 UTC | |
by Xenofur (Monk) on Apr 30, 2009 at 12:06 UTC | |
by BrowserUk (Patriarch) on May 01, 2009 at 03:23 UTC | |
|