in reply to Parallel DNS queries -- please comment on code
TIMTOWTDI --
#! perl -slw use strict; use threads qw[ async ]; use Thread::Queue; my @dnss = qw( 111.111.111.111 222.222.222.222 111.222.111.222 222.111.222.111 ); my $Q = new Thread::Queue; my $host = $ARGV[ 0 ]; my $count : shared = @dnss; async{ $Q->enqueue( qx[ nslookup -type=A $host $_ 2>nul ] ); $count--; } for @dnss; sleep 1 while $count; ## Do something with results print $Q->dequeue while $Q->pending;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Parallel DNS queries (use threads; )
by nothingmuch (Priest) on Aug 06, 2004 at 12:19 UTC | |
by BrowserUk (Patriarch) on Aug 06, 2004 at 12:27 UTC | |
by nothingmuch (Priest) on Aug 06, 2004 at 19:06 UTC | |
by BrowserUk (Patriarch) on Aug 06, 2004 at 19:46 UTC |