.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" 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::Nslookup 3pm" .TH Net::Nslookup 3pm "2017-08-03" "perl v5.26.0" "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" Net::Nslookup \- Provide nslookup(1)\-like capabilities .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use Net::Nslookup; \& my @addrs = nslookup $host; \& \& my @mx = nslookup(type => "MX", domain => "perl.org"); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\f(CW\*(C`Net::Nslookup\*(C'\fR provides the capabilities of the standard \s-1UNIX\s0 command line tool \fI\fInslookup\fI\|(1)\fR. \f(CW\*(C`Net::DNS\*(C'\fR is a wonderful and full featured module, but quite often, all you need is `nslookup \&\f(CW$host\fR`. This module provides that functionality. .PP \&\f(CW\*(C`Net::Nslookup\*(C'\fR exports a single function, called \f(CW\*(C`nslookup\*(C'\fR. \&\f(CW\*(C`nslookup\*(C'\fR can be used to retrieve A, \s-1PTR, CNAME, MX, NS, SOA,\s0 \&\s-1TXT,\s0 and \s-1SRV\s0 records. .PP .Vb 1 \& my $a = nslookup(host => "use.perl.org", type => "A"); \& \& my @mx = nslookup(domain => "perl.org", type => "MX"); \& \& my @ns = nslookup(domain => "perl.org", type => "NS"); \& \& my $name = nslookup(host => "206.33.105.41", type => "PTR"); \& \& my @srv = nslookup(term => "_jabber._tcp.gmail.com", type => "SRV"); .Ve .PP \&\f(CW\*(C`nslookup\*(C'\fR takes a hash of options, one of which should be \fIterm\fR, and performs a \s-1DNS\s0 lookup on that term. The type of lookup is determined by the \fItype\fR argument. If \fIserver\fR is specified (it should be an \s-1IP\s0 address, or a reference to an array of \s-1IP\s0 addresses), that server(s) will be used for lookups. .PP If only a single argument is passed in, the type defaults to \fIA\fR, that is, a normal A record lookup. .PP If \f(CW\*(C`nslookup\*(C'\fR is called in a list context, and there is more than one address, an array is returned. If \f(CW\*(C`nslookup\*(C'\fR is called in a scalar context, and there is more than one address, \f(CW\*(C`nslookup\*(C'\fR returns the first address. If there is only one address returned, then, naturally, it will be the only one returned, regardless of the calling context. .PP \&\fIdomain\fR and \fIhost\fR are synonyms for \fIterm\fR, and can be used to make client code more readable. For example, use \fIdomain\fR when getting \s-1NS\s0 records, and use \fIhost\fR for A records; both do the same thing. .PP \&\fIserver\fR should be a single \s-1IP\s0 address or a reference to an array of \s-1IP\s0 addresses: .PP .Vb 1 \& my @a = nslookup(host => \*(Aqexample.com\*(Aq, server => \*(Aq4.2.2.1\*(Aq); \& \& my @a = nslookup(host => \*(Aqexample.com\*(Aq, server => [ \*(Aq4.2.2.1\*(Aq, \*(Aq128.103.1.1\*(Aq ]) .Ve .PP By default, when doing \s-1CNAME, MX,\s0 and \s-1NS\s0 lookups, \f(CW\*(C`nslookup\*(C'\fR returns names, not addresses. This is a change from versions prior to 2.0, which always tried to resolve names to addresses. Pass the \&\fIrecurse => 1\fR flag to \f(CW\*(C`nslookup\*(C'\fR to have it follow \s-1CNAME, MX,\s0 and \s-1NS\s0 lookups. Note that this usage of \*(L"recurse\*(R" is not consistent with the official \s-1DNS\s0 meaning of recurse. .PP .Vb 2 \& # returns soemthing like ("mail.example.com") \& my @mx = nslookup(domain => \*(Aqexample.com\*(Aq, type => \*(AqMX\*(Aq); \& \& # returns soemthing like ("127.0.0.1") \& my @mx = nslookup(domain => \*(Aqexample.com\*(Aq, type => \*(AqMX\*(Aq, recurse => 1); .Ve .PP \&\s-1SOA\s0 lookups return the \s-1SOA\s0 record in the same format as the `host` tool: .PP .Vb 2 \& print nslookup(domain => \*(Aqexample.com\*(Aq, type => \*(AqSOA\*(Aq); \& dns1.icann.org. hostmaster.icann.org. 2011061433 7200 3600 1209600 3600 .Ve .SH "TIMEOUTS" .IX Header "TIMEOUTS" Lookups timeout after 15 seconds by default, but this can be configured by passing \fItimeout => X\fR to \f(CW\*(C`nslookup\*(C'\fR. .SH "DEBUGGING" .IX Header "DEBUGGING" Pass \fIdebug => 1\fR to \f(CW\*(C`nslookup\*(C'\fR to emit debugging messages to \s-1STDERR.\s0 .SH "AUTHOR" .IX Header "AUTHOR" darren chamberlain