in reply to DNS lookups & signals

Two things - Perl does use the _r variants if available, but these provide thread-safety rather than async capabilities. Second, Net::DNS does provide a non-blocking variant. From its man page:
=head2 Perform a background query and do some other work while waiting for the answer. use Net::DNS; my $res = Net::DNS::Resolver->new; my $socket = $res->bgsend("host.example.com"); until ($res->bgisready($socket)) { # do some work here while waiting for the answer # ...and some more here } my $packet = $res->bgread($socket); $packet->print;

Replies are listed 'Best First'.
Re: Re: DNS lookups & signals
by jfroebe (Parson) on May 13, 2004 at 21:24 UTC

    THANKS!

    Now that you point it out, I see it.. :-( Is it time to go home yet?

    Yup, I should have been more explicit. I was thinking of pushing the lookup off into a thread and go do something else. I ended up shooting off another process as the thread hung the main process.

    No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1

      I was thinking of pushing the lookup off into a thread and go do something else

      If by chance that something else would be... yet another DNS lookup, you might be better off using a POE::Component::Client::DNS object and perform many lookups in parallel. This can be a big win, provided you don't particularly care in which order the results come back. That is, if you ask for A, B, C, you might get the results back in the order B, C, A (but in general this is not a problem).

      There's a recipe in the POE cookbook that can help you get started.

      Is it time to go home yet?
      yes, probably ;-)