Subject: | PTR lookups don't work |
#!/usr/bin/perl
use Net::Nslookup;
$Net::Nslookup::DEBUG = 1;
$Net::Nslookup::DEBUG_NET_DNS = 1;
# example usage. it doesn't return anything.
my $name = nslookup(host => "206.33.105.41", type => "PTR");
print "got: '$name'\n";
# the above code returns nothing. The problem is in the _lookup_ptr
routine:
#sub _lookup_ptr {
# my ($term, $server) = @_;
# my $res = ns($server);
# my (@answers, $query, $rr);
#
# debug("Performing 'PTR' lookup on `$term'");
#
# $query = $res->search($term, "PTR") || return;
# for $rr ($query->answer) {
# if ($rr->can('ptrdname')) {
# push @answers, $rr->ptrdname;
# }
# }
#
# return @answers;
#}
#There seems to be a problem with the method Net::DNS::RR->can() -- I'm
not sure it exists. I don't see it in the docs anywhere.
#Maybe the code should be:
# for $rr ($query->answer) {
# if ($rr->ptrdname) {
# push @answers, $rr->ptrdname;
# }
# }
#perl v5.8.6
#OS X 10.4