Threads work well (for this request) on Windows:
use feature ":5.14"; use warnings FATAL => qw(all); use strict; use threads; use LWP::Simple; my @u = qw(drudgereport.com rushlimbaugh.com/home/today.guest.html yah +oo.com appaapps.com cdsllc.com gdfgfasgdfgfs.jkl); sub u($) {get('http://www.'.$_[0])} # Web request my %t; $t{threads->create('u', $_)->tid}{url} = $_ for @u; # Start th +reads for(1..10) # Retrieve completed requests with time limits {$t{$_->tid}{data} = $_->join for threads->list(threads::joinable); last unless scalar threads->list(threads::running); sleep(1); } say $t{$_}{url}, "=", ($t{$_}{data} ? 1 : 0) for sort {$t{$a}{url} cmp + $t{$b}{url}} keys %t;
Produces
appaapps.com=1 cdsllc.com=1 drudgereport.com=1 gdfgfasgdfgfs.jkl=0 rushlimbaugh.com/home/today.guest.html=1 yahoo.com=1
In reply to Re: check multiple URLS in the same time
by philiprbrenan
in thread check multiple URLS in the same time
by sabri
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |