Lotus1 has asked for the wisdom of the Perl Monks concerning the following question:
This is from the examples section of Net::DNS :
use Net::DNS; my $res = Net::DNS::Resolver->new; my $reply = $res->search("www.example.com", "A"); if ($reply) { foreach my $rr ($reply->answer) { print $rr->address, "\n" if $rr->can("address"); } } else { warn "query failed: ", $res->errorstring, "\n"; }
The search method in the resolver returns a packet object. Then the 'answer' method of that (from Net::DNS::Packet) "Returns a list of Net::DNS::RR objects representing the answer section of the packet." I've looked through the documentation for Net::DNS::RR and the module sourch but can't find the description of what the 'can' method is. The example runs without errors while using strict and warnings. Any suggestions?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: In Net::DNS::RR what is the 'can' method? (updated)
by haukex (Archbishop) on Sep 19, 2018 at 18:15 UTC | |
by Lotus1 (Vicar) on Sep 19, 2018 at 18:28 UTC |