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

On my windows machine I cannot get any of the examples from to work. I know the module is installed correctly and there aren't any noticable errors in the code that my program or CMD will pick up. I looked through the docs and FAQs but it never said it can't work for Windows machines. The error I get is: query failed: connection failed for both snippets I tried. Anyone know what might be the problem or know of another module which might work?

Replies are listed 'Best First'.
by jand (Friar) on Apr 28, 2003 at 18:39 UTC
    Net::DNS has been broken on Windows for a while. I can't remember which version was the last to work though. You may want to try older versions from the Net::DNS website.
by Improv (Pilgrim) on Apr 28, 2003 at 17:59 UTC
    A few things:
    • Is DNS set up correctly on your system? Do other DNS queries work? (e.g. can IE or Mozilla resolve
    • What version of Net::DNS are you using?
    • What examples are you trying? What errors do they give?
    • Yes, IE can go to websites.
    • Version is 0.34
    • One of the examples are
      #/usr/bin/perl -w use warnings; use strict; use Net::DNS; my $rr; my $res = Net::DNS::Resolver->new; my $query = $res->query("", "NS"); if ($query) { foreach $rr ($query->answer) { next unless $rr->type eq "NS"; print $rr->nsdname, "\n"; } } else { print "query failed: ", $res->errorstring, "\n"; }
        Ok, by not working, does it print 'query failed', or does it die, or do something else? Is it possible you're behind a firewall, and just accessing the web through a proxy?
by jand (Friar) on May 08, 2003 at 02:08 UTC
    I needed Net::DNS myself, and even the earlier versions (0.12) didn't work on my Win2K Server box, so I tried to figure out what is wrong.

    It looks like Net::DNS doesn't discover the name servers correctly. I added some code for both Win 95/98/Me as well as some (different) code for 2K / XP. Windows NT however should work as is.

    You can find my patch attached to the corresponding RT ticket.