Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

using Net::DNS::Async

by goose722 (Initiate)
on Feb 28, 2012 at 21:06 UTC ( [id://956767]=perlquestion: print w/replies, xml ) Need Help??

goose722 has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I'm trying to use Net::DNS::Async to query several nameservers with one hostname simultaneously. I then want to compare the results. However, I can't figure out how to make a new Net::DNS::Async object that will use the specific nameservers I want to use. What I did initially was follow the rules from Net::DNS:
my $res = new Net::DNS::Async(...); $res->nameserver(qw(server1 server2 server3));
This returns an error - the Net::DNS::Async object does not have a nameserver method. What do I do?

Replies are listed 'Best First'.
Re: using Net::DNS::Async
by Riales (Hermit) on Feb 28, 2012 at 21:33 UTC

    I've never used this module before, but I dug briefly through the source and it looks like you can specify nameservers by passing it in within a hash in the add method. The documentation says to pass it a callback there, but if you give it a hashref instead, it will set nameservers according to whatever you specify.

    Maybe something like this:

    my $res = new Net::DNS::Async(..); $res->add( { Nameserver => [$server1], Callback => \&callback, }, @params );
      Can I ask for the link to the documentation you were looking at? Thanks a lot, by the way.

        Sure: Net::DNS::Async

        Also, here's the relevant code snippet from the module:

        sub add { my ($self, $params, @query) = @_; my ($callback, @ns); if (ref($params) eq 'HASH') { @query = @{ $params->{Query} } if exists $params->{Query}; $callback = $params->{Callback}; @ns = @{ $params->{Nameservers} } if exists $params->{Nameserv +ers}; } else { $callback = $params; } (...) }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-20 02:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found