#!/usr/local/bin/perl use LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->timeout(2); $page = 'http://www.sics.se/~joe/bluetail/vol1/v1_oo.html'; use threads; $total = 0; while (1==1) { if ($total < 50) { $total++; my $threadname = 'thr'.$total; $$threadname = threads->create(\&sub1, $page); } foreach my $thread_join (threads->list(threads::joinable)) { my $res = $thread_join->join(); print "RES:[$res]\n"; } sleep(1); } sub sub1() { my ($url) = @_; print "\t FETCHED $url\n"; my $response = $ua->get($url); if ($response->is_success) { $content = $response->decoded_content; } else { $content = ''; } return length($content); }