NAME

Nginx::Engine::Cookies::Resolver - Asynchronous TCP DNS resolver

SYNOPSIS

use Nginx::Engine;
use Nginx::Engine::Cookies::Resolver;

ngxe_init("./ngxe-error.log", 128);

ngxk_resolve("google.com", sub {
    my ($domain, $error, $response) = @_;

    if ($error) {
        warn "$domain: error: $error\n";
        return;
    }

    print "$domain: $response->[0]\n";
});

ngxe_loop;

DESCRIPTION

This is a simple ready to use asynchronous resolver for Nginx::Engine.

It tries to find nameservers in resolv.conf either in /etc or home directory or uses public DNS and issues a warning.

Nginx::Engine doesn't have built-in resolver just yet.

DEPENDENCIES

Nginx::Engine, Net::DNS

EXPORT

The following functions are exported by default:

ngxk_resolve

FUNCTIONS

ngxk_resolve(DOMAIN, CALLBACK, ...)

Resolves DOMAIN and calls back with the results. Can take any number of extra arguments after CALLBACK.

First argument passed to the callback is the name of the domain. Second is error identifier. Third is the resulting ARRAYREF with the list of resolved IP addresses and the rest are extra arguments.

$_[0] - domain
$_[1] - error 
$_[2] - results
@_[3..$#_] - extra arguments

SEE ALSO

Nginx::Engine, Net::DNS

AUTHOR

Alexandr Gomoliako <zzz@zzz.org.ua>

COPYRIGHT

Copyright 2010 Alexandr Gomoliako. All rights reserved.

This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.