Having issues using AnyEvent::DNS with a call back
Michael Greb
michael at thegrebs.com
Wed Jun 16 15:13:20 CEST 2010
On Jun 16, 2010, at 3:45 AM, Robin Redeker wrote:
<snip>
> You are not running any event loop here. There are only very few operations
> with AnyEvent that actually block (and execute a/the event loop). One of them
> is the recv() method of a condvar.
This makes sense, I suppose at this point I should read through AnyEvent::Intro
<snip>
> Yep, here $cv->recv blocks until the domain is resolved and returns the result.
>
> If you need a callback try:
>
> $dns->resolve( "thegrebs.com", "mx", my $cv = AnyEvent->condvar );
> $cv->cb (sub {
> my ($cv) = @_;
> warn Dumper [$cv->recv]; # inside the callback recv() doesn't block.
> });
Well, there's the real problem ;) I see the same failed behavior with this, the script exits 0 almost immediately with no output. AnyEvent version on 5.271 the Apple supplied Perl 5.10.0 as well as on the Debian Lenny supplied Perl 5.10.0 and Debian Sid Perl 5.10.1.
Mike
More information about the anyevent
mailing list