[PLUG] Perl help - Net::DNS objects

Michael Rasmussen mikeraz at patch.com
Mon Apr 30 15:35:06 UTC 2007


drew wymore wrote:
> I'm trying to write a small DNS monitoring script using the Net::DNS perl
> module. I'm running into trouble when I use Net::DNS::Resolver and define
> nameservers($) .. I can loop through them and then using Net::DNS::Packet I
> can send a query however it appears that its only sending the packet to the
> first DNS server in my list and reporting the return object for both servers
> which is not what I want.

A code snip would be very useful.

>From my quick perusal of the docs you'd need to do something like set (from
example) $res->searchlist to array of one server to contact, do your query, set
$res->searchlist to next server, repeat query, loop as needed.


The module is set up for generalized DNS use.  To do special operations, like
testing, you need to take special actions.

> The docs for the module don't
> specify either way if they methods can be used in an array context or not.

The docs do specify either scalar or array return value.
It's really safe to assume that if not stated otherwise, the return value shown in
the example is what you get.  If it shows a scalar, you won't get an array, or
even a reference to an array.


-- 
   Michael Rasmussen, Portland, Ore, USA
  Be Appropriate && Follow Your Curiosity
        http://www.patch.com/words/





More information about the PLUG mailing list