NAME

Test::DNS - Test DNS queries and zone configuration

VERSION

Version 0.02

SYNOPSIS

This module helps you write tests for DNS queries. You could test your domain configuration in the world or on a specific DNS server, for example.

use Test::DNS;
use Test::More tests => 4;

my $dns = Test::DNS->new();

$dns->is_ptr( '1.2.3.4' => 'single.ptr.record.com' );
$dns->is_ptr( '1.2.3.4' => [ 'one.ptr.record.com', 'two.ptr.record.com' ] );
$dns->is_ns( 'google.com' => [ map { "ns$_.google.com" } 1 .. 4 ] );
$dns->is_a( 'ns1.google.com' => '216.239.32.10' );

...

EXPORT

This module is completely Object Oriented, nothing is exported.

ATTRIBUTES

nameservers

Same as in Net::DNS. Sets the nameservers, accepts an arrayref.

$dns->nameservers( [ 'IP1', 'DOMAIN' ] );

warnings

Do you want to output warnings from the module, such as when a record doesn't a query result or incorrect types?

This helps avoid common misconfigurations. You should probably keep it, but if it bugs you, you can stop it using:

$dns->warnings(0);

Default: 1 (on).

follow_cname

When fetching an A record of a domain, it may resolve to a CNAME instead of an A record. That would result in a false-negative of sorts, in which you say "well, yes, I meant the A record the CNAME record points to" but Test::DNS doesn't know that.

If you want want Test::DNS to follow every CNAME till it reaches the actual A record and compare that A record, use this option.

$dns->follow_cname(1);

Default: 0 (off).

SUBROUTINES/METHODS

is_a

Check the A record resolving of domain or subdomain.

$dns->is_a( 'domain' => 'IP' );

$dns->is_a( 'domain', [ 'IP1', 'IP2' ] );

is_ns

Check the NS record resolving of a domain or subdomain.

$dns->is_ns( 'domain' => 'IP' );

$dns->is_ns( 'domain', [ 'IP1', 'IP2' ] );

is_ptr

Check the PTR records of an IP.

$dns->is_ptr( 'IP' => 'ptr.records.domain' );

$dns->is_ptr( 'IP', [ 'first.ptr.domain', 'second.ptr.domain' ] );

is_mx

Check the MX records of a domain.

$dns->is_mx( 'domain' => 'mailer.domain' );

$dns->is_ptr( 'domain', [ 'mailer1.domain', 'mailer2.domain' ] );

is_cname

Check the CNAME records of a domain.

$dns->is_cname( 'domain' => 'sub.domain' );

$dns->is_cname( 'domain', [ 'sub1.domain', 'sub2.domain' ] );

is_record

The general function all the other is_* functions run.

$dns->is_record( 'CNAME', 'domain', 'sub.domain', 'test_name' );

DEPENDENCIES

Moose

Net::DNS

Test::Deep

Set::Object

AUTHOR

Sawyer X, <xsawyerx at cpan.org>

BUGS

Please report any bugs or feature requests to bug-test-dns at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-DNS. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Test::DNS

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2010 Sawyer X.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.