Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: problem querying TLD nameserver with Net::DNS::Resolver

by bingos (Vicar)
on Feb 24, 2011 at 10:48 UTC ( #889953=note: print w/ replies, xml ) Need Help??


in reply to problem querying TLD nameserver with Net::DNS::Resolver

Your variable is undefined because there wasn't an answer to the specific question you asked

From the Net::DNS::Resolver documentation:

Returns a "Net::DNS::Packet" object, or "undef" if no answers were found. If you need to examine the response packet whether it contains any answers or not, use the send() method instead.

This amended code uses send() instead:

use strict; use warnings; use Net::DNS; my $domain = $ARGV[0]; #192.48.79.30 is j.gtld-servers.net my $res = Net::DNS::Resolver->new( nameservers => [qw(192.48.79.30)], recurse => 1, debug => 1, ); my $packet = $res->send("$domain", 'NS'); my @authority = $packet->authority; foreach my $rr (@authority) { print $rr->string, "\n"; }


Comment on Re: problem querying TLD nameserver with Net::DNS::Resolver
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2015-07-04 04:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls