.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "Net::LDNS 3pm" .TH Net::LDNS 3pm "2016-06-27" "perl v5.24.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" .Vb 1 \& Net::LDNS \- DNS\-talking module based on the ldns C library .Ve .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& my $resolver = Net::LDNS\->new(\*(Aq8.8.8.8\*(Aq); \& my $packet = $resolver\->query(\*(Aqwww.iis.se\*(Aq); \& say $packet\->string; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\f(CW\*(C`Net::LDNS\*(C'\fR represents a resolver, which is the part of the system responsible for sending queries and receiving answers to them. .SH "EXPORTABLE FUNCTIONS" .IX Header "EXPORTABLE FUNCTIONS" .IP "\fIlib_version()\fR" 4 .IX Item "lib_version()" Returns the ldns version string. Can be exported, but is not by default. .IP "to_idn($name, ...)" 4 .IX Item "to_idn($name, ...)" Takes a number of strings and returns a list of them converted to \s-1IDNA\s0 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. .Sp This function requires that \s-1GNU\s0 libidn was present when Net::LDNS was compiled. If not, calling \f(CW\*(C`to_idn\*(C'\fR will result in an exception getting thrown. .IP "\fIhas_idn()\fR" 4 .IX Item "has_idn()" Takes no arguments. Returns true if libidn was present at compilation, false if not. .IP "\fIhas_gost()\fR" 4 .IX Item "has_gost()" Takes no arguments. Returns true if \s-1GOST\s0 support was present at compilation, false if not. .IP "load_zonefile($filename)" 4 .IX Item "load_zonefile($filename)" Load all resource records in a zone file, returning them as a list. .SH "CLASS METHOD" .IX Header "CLASS METHOD" .IP "new($addr,...)" 4 .IX Item "new($addr,...)" Creates a new resolver object. If given no arguments, if will pick up nameserver addresses from the system configuration (\fI/etc/resolv.conf\fR or equivalent). If given a single argument that is \f(CW\*(C`undef\*(C'\fR, 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 \f(CW\*(C`undef\*(C'\fR, 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 \s-1IP\s0 address, an exception will be thrown. .SH "INSTANCE METHODS" .IX Header "INSTANCE METHODS" .ie n .IP "query($name, $type, $class)" 4 .el .IP "query($name, \f(CW$type\fR, \f(CW$class\fR)" 4 .IX Item "query($name, $type, $class)" Send a query for the given triple. If type or class are not provided they default to A and \s-1IN,\s0 respectively. Returns a Net::LDNS::Packet or undef. .IP "name2addr($name)" 4 .IX Item "name2addr($name)" Asks this resolver to look up A and \s-1AAAA\s0 records for the given name, and return a list of the \s-1IP\s0 addresses (as strings). In scalar context, returns the number of addresses found. .IP "addr2name($addr)" 4 .IX Item "addr2name($addr)" Takes an \s-1IP\s0 address, asks the resolver to do \s-1PTR\s0 lookups and returns the names found. In scalar context, returns the number of names found. .IP "recurse($flag)" 4 .IX Item "recurse($flag)" Returns the setting of the recursion flag. If given an argument, it will be treated as a boolean and the flag set accordingly. .IP "debug($flag)" 4 .IX Item "debug($flag)" Gets and optionally sets the debug flag. .IP "dnssec($flag)" 4 .IX Item "dnssec($flag)" Get and optionally sets the \s-1DNSSEC\s0 flag. .IP "cd($flag)" 4 .IX Item "cd($flag)" Get and optionally sets the \s-1CD\s0 flag. .IP "igntc($flag)" 4 .IX Item "igntc($flag)" Get and optionally sets the igntc flag. .IP "usevc($flag)" 4 .IX Item "usevc($flag)" Get and optionally sets the usevc flag. .IP "retry($count)" 4 .IX Item "retry($count)" Get and optionally set the number of retries. .IP "retrans($seconds)" 4 .IX Item "retrans($seconds)" Get and optionally set the number of seconds between retries. .IP "port($port)" 4 .IX Item "port($port)" Get and optionally set the destination port for requests. .IP "edns_size($size)" 4 .IX Item "edns_size($size)" Get and optionally set the \s-1EDNS0 UDP\s0 maximum size. .ie n .IP "axfr( $domain, $callback, $class )" 4 .el .IP "axfr( \f(CW$domain\fR, \f(CW$callback\fR, \f(CW$class\fR )" 4 .IX Item "axfr( $domain, $callback, $class )" Perform an \s-1AXFR\s0 operation. \f(CW$callback\fR must be a code reference, which will be called once for every received resource record with the \s-1RR\s0 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 \s-1AXFR\s0 process will be aborted. The return value of the \f(CW\*(C`axfr()\*(C'\fR method itself will be true if the transfer completed normally, and false if it was aborted because the callback returned a false value. .Sp If anything goes wrong during the process, an exception will be thrown. .Sp As an example, saving all the RRs received from an \s-1AXFR\s0 can be done like this: .Sp .Vb 2 \& my @rrs; \& $resolver\->axfr( $domain, sub { my ($rr) = @_; push @rrs, $rr; return 1;} ); .Ve .IP "axfr_start($domain,$class)" 4 .IX Item "axfr_start($domain,$class)" Deprecated. Use \fIaxfr()\fR instead. .Sp Set this resolver object up for a zone transfer of the specified domain. If \f(CW$class\fR is not given, it defaults to \s-1IN.\s0 .IP "\fIaxfr_next()\fR" 4 .IX Item "axfr_next()" Deprecated. Use \fIaxfr()\fR instead. .Sp Get the next \s-1RR\s0 in the zone transfer. \fIaxfr_start()\fR must have been done before this is called, and after this is called \fIaxfr_complete()\fR 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: .Sp .Vb 4 \& $res\->axfr_start(\*(Aqexample.org\*(Aq); \& do { \& push @rrlist, $res\->axfr_next; \& } until $res\->axfr_complete; .Ve .IP "\fIaxfr_complete()\fR" 4 .IX Item "axfr_complete()" Deprecated. Use \fIaxfr()\fR instead. .Sp Returns false if there is a started zone transfer with more records to get, and true if the started transfer has completed. .IP "\fIaxfr_last_packet()\fR" 4 .IX Item "axfr_last_packet()" Deprecated. Use \fIaxfr()\fR instead. .Sp If \fIaxfr_next()\fR threw an exception, this method returns the Net::LDNS::Packet that made it do so. The packet's \s-1RCODE\s0 is likely to say what the problem was (for example, \s-1NOTAUTH\s0 or \s-1NXDOMAIN\s0). .IP "timeout($time)" 4 .IX Item "timeout($time)" Get and/or set the socket timeout for the resolver. .IP "source($addr)" 4 .IX Item "source($addr)" Get and/or set the \s-1IP\s0 address the resolver should try to send its queries from.