svankalken has asked for the wisdom of the Perl Monks concerning the following question:
Now, this may or may not be a general question on subroutines, or it may be a net::dns one specifically, I'm not sure. Any help or pointers would be appreciated.Can't call method "search" on an undefined value at ./test.pl line 8.
...found the problem....no new resolve declared.... <feels stupid>use NetAddr::IP; use Net::DNS::Resolver; sub reverselookup($) { my ($ip) = @_; my $search = $res->search($ip); foreach $rr ( $search->$answer) { my $type=$rr->type; if ($type eq "A") { $host=$rr->address; } if ($type eq "PTR") { $host=$rr->ptrdname; } } } &reverselookup("61.9.128.17");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::DNS::Resolver problem with subroutine.
by fluxion (Monk) on Jun 27, 2004 at 13:47 UTC |