| 1 | package Net::DNS::Check::Test::ns_compare; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use vars qw(@ISA $VERSION); | ||
| 5 | |||
| 6 | @ISA = qw(Net::DNS::Check::Test); | ||
| 7 | |||
| 8 | |||
| 9 | sub new { | ||
| 10 | my ($class) = shift; | ||
| 11 | |||
| 12 | my ($self) = bless {}, $class; | ||
| 13 | |||
| 14 | if ( @_ ) { | ||
| 15 | $self->_process_args(@_); | ||
| 16 | } | ||
| 17 | |||
| 18 | $self->test(); | ||
| 19 | |||
| 20 | return $self; | ||
| 21 | } | ||
| 22 | |||
| 23 | sub test() { | ||
| 24 | my ($self) = shift; | ||
| 25 | |||
| 26 | # return unless ( $self->{config} ); | ||
| 27 | |||
| 28 | my $test_status = 1; | ||
| 29 | my %compare_hash; | ||
| 30 | my $test_detail = {}; | ||
| 31 | |||
| 32 | foreach my $nsquery ( @{$self->{nsquery}} ) { | ||
| 33 | my @ns_list = sort $nsquery->ns_list(); | ||
| 34 | my $ns_name = $nsquery->ns_name(); | ||
| 35 | my $nskey = lc(join('|', @ns_list)); | ||
| 36 | |||
| 37 | if ($nskey) { | ||
| 38 | $compare_hash{$nskey}++; | ||
| 39 | } | ||
| 40 | |||
| 41 | $test_detail->{$ns_name}->{desc} = join(' ', @ns_list); | ||
| 42 | } | ||
| 43 | |||
| 44 | if ((scalar keys %compare_hash) > 1) { | ||
| 45 | $test_status = 0; | ||
| 46 | } | ||
| 47 | |||
| 48 | $self->{test_status} = $test_status; | ||
| 49 | $self->{test_detail} = $test_detail; | ||
| 50 | |||
| 51 | return $test_status; | ||
| 52 | } | ||
| 53 | |||
| 54 | 1; | ||
| 55 | |||
| 56 | __END__ |