Having issues using AnyEvent::DNS with a call back

Michael Greb michael at thegrebs.com
Wed Jun 16 06:52:00 CEST 2010


AnyEvent::DNS docs indicate the following should work, however the script exits 0 nearly instantly with no output:

use AnyEvent::DNS;
use Data::Dumper;
my $dns = AnyEvent::DNS->new();
$dns->resolve( "thegrebs.com", "mx", sub { warn Dumper[@_]} );


The alternative script below works as expected:

use AnyEvent::DNS;
use Data::Dumper;
my $dns = AnyEvent::DNS->new();
$dns->resolve( "thegrebs.com", "mx", my $cv = AnyEvent->condvar );
warn Dumper [$cv->recv];

It's quite likely I missed something important in the docs.  I'm brand new to AnyEvent and am actually trying to use AnyEvent::SMTP::Client to send an alert email in a situation where I don't want failed messages queued for later re-attempts.  While trying to track down the failure in the debugger I isolated it to AnyEvent::SMTP::Client's attempt to retrieve the MX records via AnyEvent::DNS.

Any pointers or other assistance would be greatly appreciated.

Mike


More information about the anyevent mailing list