Rand Stats

The uploading author of cpan:RBT does not match the META author of github:retupmoca.

Net::DNS

cpan:RBT

Net::DNS

A simple DNS resolver.

Note: If you are behind a firewall that blocks Google DNS, you will need to set DNS_TEST_HOST in your environment to pass the tests.

Example Usage

my $resolver = Net::DNS.new('8.8.8.8'); # google dns server

my @mx-ips = $resolver.lookup-mx('gmail.com');

my @all = $resolver.lookup-ips('google.com');
my @ipv4 = $resolver.lookup-ips('google.com', :inet);
my @ipv6 = $resolver.lookup-ips('google.com', :inet6);

my @dns-answers = $resolver.lookup('A', 'google.com'); # ("1.2.3.4", "5.6.7.8", ...)

Methods

Supported DNS Types

The return of a lookup is a list of classes. Which class depends on the request type.

The object returned will stringify to something useful, and will also provide attributes to access each piece of information that was returned.

Note that all of these classes also have a @.owner-name attribute. Normally this is the same as the domain name you did the lookup on.

Exceptions

DNS Server errors will produce a Failure response on lookup(), lookup-ips(), and lookup-mx() with an X::Net::DNS object.