Posted on 2008-08-31 23:17:08-07 by gw1500se
Net::Nslookup not working with Cygwin
I first posted this problem on the Cygwin forum as it seems to unique to that OS. However, I was advised to post it here. I am trying to use the perl module Net::Nslookup but it does not work (it is almost too simple to program wrong), particularly for doing reverse lookups. Here is my test program:
#!/usr/bin/perl -w use strict; use Net::Nslookup; my $name=nslookup(host=>"70.158.194.7",type=>"PTR"); print($name."\n");

The following is the error that I get:

Use of uninitialized value $name in concatenation (.) or string at ./test.pl line 7.

Initially my /etc/hosts file was a link the the Windows host file. That was loaded with values for 127.0.0.1 by SpyBot S&D for some reason. I then deleted the link and created a new /etc/hosts with the single line:

127.0.0.1 localhost

It is apparent that the look up is not working however 'nslookup' from the command line seems to work fine. As an aside, I also tried Net::DNS and Net::IP which also failed. That is what makes me suspect something is wrong with Cygwin.

Thanks for any help.
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.