NLnet Labs > Net-DNS > Net::DNS::Resolver::Recurse

Download:
Net-DNS-0.81.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  1
Stalled  2
View/Report Bugs
Module Version: 1282   Source  

NAME ^

Net::DNS::Resolver::Recurse - DNS recursive resolver

SYNOPSIS ^

    use Net::DNS::Resolver::Recurse;

    $resolver = new Net::DNS::Resolver::Recurse();

    $packet = $resolver->query ( 'www.example.com', 'A' );
    $packet = $resolver->search( 'www.example.com', 'A' );
    $packet = $resolver->send  ( 'www.example.com', 'A' );

DESCRIPTION ^

This module is a subclass of Net::DNS::Resolver.

METHODS ^

This module inherits almost all the methods from Net::DNS::Resolver. Additional module-specific methods are described below.

hints

This method specifies a list of the IP addresses used to locate the authoritative name servers for the root (.) zone.

    $resolver->hints(@ip);

If no hints are passed, the default nameserver is used to discover the addresses of the root nameservers.

If the default nameserver not been configured correctly, or at all, a built-in list of IP addresses is used.

query, search, send

The query(), search() and send() methods produce the same result as their counterparts in Net::DNS::Resolver.

    $packet = $resolver->send( 'www.example.com.', 'A' );

Server-side recursion is suppressed by clearing the recurse flag in the packet and recursive name resolution is performed explicitly.

The query() and search() methods are inherited from Net::DNS::Resolver and invoke send() indirectly.

callback

This method specifies a code reference to a subroutine, which is then invoked at each stage of the recursive lookup.

For example to emulate dig's +trace function:

    my $coderef = sub {
        my $packet = shift;

        $_->print for $packet->additional;

        printf ";; Received %d bytes from %s\n\n",
                $packet->answersize, $packet->answerfrom;
    };

    $resolver->callback($coderef);

The callback subroutine is not called for queries for missing glue records.

ACKNOWLEDGEMENT ^

This package is an improved and compatible reimplementation of the Net::DNS::Resolver::Recurse.pm created by Rob Brown in 2002.

The contribution of Rob Brown is gratefully acknowledged.

COPYRIGHT ^

Copyright (c)2014 Dick Franks

Portions Copyright (c)2002 Rob Brown

All rights reserved.

This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO ^

Net::DNS::Resolver

syntax highlighting: