Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: check multiple URLS in the same time

by philiprbrenan (Monk)
on Sep 01, 2012 at 16:39 UTC ( #991170=note: print w/ replies, xml ) Need Help??

in reply to check multiple URLS in the same time

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( yah 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 gdfgfasgdfgfs.jkl=0

Comment on Re: check multiple URLS in the same time
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://991170]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2015-11-25 03:25 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (670 votes), past polls