Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Nslookup using a different DNS server

by johnnywang (Priest)
on Nov 14, 2005 at 20:06 UTC ( [id://508400]=note: print w/replies, xml ) Need Help??


in reply to Nslookup using a different DNS server

I've been using Net::DNS::Resolver, which you can put the dns server name in the constructor. Something like the following:
use Net::DNS::Resolver; my $nameserver = "10.1.10.42"; my $resolver = Net::DNS::Resolver->new( nameservers=>[$nameserver], recurse =>1, debug =>0, ); my @addresses = (); my $host ='yahoo.com'; my $query = $resolver->search($host); if ($query){ foreach my $rr ($query->answer) { next unless $rr->type eq "A"; push @addresses,$rr->address if $rr->address =~/^[\d\.]+$/; } } else { warn "query failed: ", $resolver->errorstring, "\n"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://508400]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-26 02:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found