Data-Checker
view release on metacpan or search on metacpan
lib/Data/Checker/DNS.pod view on Meta::CPAN
use Data::Checker;
$obj = new Data::Checker;
$data = ...
$opts = ...
($pass,$fail,$info,$warn) = $obj->check($data,"DNS",$opts);
The value of C<$data> and C<$opts> is listed below in the examples.
=over 4
=item To check if a hostname is fully qualified
$data = [ 'foo', 'bar.com' ];
$opts = { 'qualified' => undef };
This yields:
$pass = [ 'bar.com' ]
$fail = { 'foo' => [ 'Host is not fully qualified' ] }
=item To check if a hostname is NOT fully qualified:
$data = [ 'foo', 'bar.com' ];
$opts = { 'qualified' => { 'negate' => 1 } };
This yields:
$pass = [ 'foo' ]
$fail = { 'bar.com' => [ 'Host is fully qualified' ] }
=item To check that a host is in DNS:
$data = [ 'cpan.org', 'aaa.bbb.ccc' ];
$opts = { 'dns' => undef };
=item To check that a host has the expected IP in DNS
Current DNS shows:
cpan.org = 207.171.7.91
blogs.perl.org = 188.40.132.3
The test:
$data = { 'cpan.org' => { 'ip' => '207.171.7.91' },
'blogs.perl.org' => { 'ip' => '100.101.102.103' }
};
$opts = { 'dns' => undef,
'expected_ip' => undef };
Yields:
$pass = { 'cpan.org' => { 'ip' => '207.171.7.91' } }
$fail = { 'blogs.perl.org' => [ 'DNS IP value does not match expected value' ] }
=back
=head1 KNOWN BUGS AND LIMITATIONS
None known.
=head1 SEE ALSO
L<Data::Checker>, L<Net::DNS>
=head1 LICENSE
This script is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=head1 AUTHOR
Sullivan Beck (sbeck@cpan.org)
=cut
( run in 1.653 second using v1.01-cache-2.11-cpan-39bf76dae61 )