Rand Stats

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




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(''); # 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'); # ("", "", ...)


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.


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