DOKK / manpages / debian 10 / libnet-ldns-perl / Net::LDNS.3pm.en
Net::LDNS(3pm) User Contributed Perl Documentation Net::LDNS(3pm)

    Net::LDNS - DNS-talking module based on the ldns C library

    my $resolver = Net::LDNS->new('8.8.8.8');
    my $packet   = $resolver->query('www.iis.se');
    say $packet->string;

"Net::LDNS" represents a resolver, which is the part of the system responsible for sending queries and receiving answers to them.

Returns the ldns version string. Can be exported, but is not by default.
Takes a number of strings and returns a list of them converted to IDNA format. Assumes that the strings have been converted to Perl's internal encoding before it's called. Can be exported, but is not by default.

This function requires that GNU libidn was present when Net::LDNS was compiled. If not, calling "to_idn" will result in an exception getting thrown.

Takes no arguments. Returns true if libidn was present at compilation, false if not.
Takes no arguments. Returns true if GOST support was present at compilation, false if not.
Load all resource records in a zone file, returning them as a list.

Creates a new resolver object. If given no arguments, if will pick up nameserver addresses from the system configuration (/etc/resolv.conf or equivalent). If given a single argument that is "undef", it will not know of any nameservers and all attempts to send queries will throw exceptions. If given one or more arguments that are not "undef", attempts to parse them as IPv4 and IPv6 addresses will be made, and if successful make up a list of servers to send queries to. If an argument cannot be parsed as an IP address, an exception will be thrown.

Send a query for the given triple. If type or class are not provided they default to A and IN, respectively. Returns a Net::LDNS::Packet or undef.
Asks this resolver to look up A and AAAA records for the given name, and return a list of the IP addresses (as strings). In scalar context, returns the number of addresses found.
Takes an IP address, asks the resolver to do PTR lookups and returns the names found. In scalar context, returns the number of names found.
Returns the setting of the recursion flag. If given an argument, it will be treated as a boolean and the flag set accordingly.
Gets and optionally sets the debug flag.
Get and optionally sets the DNSSEC flag.
Get and optionally sets the CD flag.
Get and optionally sets the igntc flag.
Get and optionally sets the usevc flag.
Get and optionally set the number of retries.
Get and optionally set the number of seconds between retries.
Get and optionally set the destination port for requests.
Get and optionally set the EDNS0 UDP maximum size.
Perform an AXFR operation. $callback must be a code reference, which will be called once for every received resource record with the RR object as its one and only argument. After every such call, the return value of the callback will be examined, and if the value is false the AXFR process will be aborted. The return value of the "axfr()" method itself will be true if the transfer completed normally, and false if it was aborted because the callback returned a false value.

If anything goes wrong during the process, an exception will be thrown.

As an example, saving all the RRs received from an AXFR can be done like this:

    my @rrs;
    $resolver->axfr( $domain, sub { my ($rr) = @_; push @rrs, $rr; return 1;} );
    
Deprecated. Use axfr() instead.

Set this resolver object up for a zone transfer of the specified domain. If $class is not given, it defaults to IN.

Deprecated. Use axfr() instead.

Get the next RR in the zone transfer. axfr_start() must have been done before this is called, and after this is called axfr_complete() should be used to check if there are more records to get. If there's any problem, an exception will be thrown. Basically, the sequence should be something like:

    $res->axfr_start('example.org');
    do {
        push @rrlist, $res->axfr_next;
    } until $res->axfr_complete;
    
Deprecated. Use axfr() instead.

Returns false if there is a started zone transfer with more records to get, and true if the started transfer has completed.

Deprecated. Use axfr() instead.

If axfr_next() threw an exception, this method returns the Net::LDNS::Packet that made it do so. The packet's RCODE is likely to say what the problem was (for example, NOTAUTH or NXDOMAIN).

Get and/or set the socket timeout for the resolver.
Get and/or set the IP address the resolver should try to send its queries from.
2019-04-24 perl v5.28.1