1package Net::DNS::Check::Test::mx_present;
2
3use strict;
4use vars qw(@ISA $VERSION);
5
6@ISA     = qw(Net::DNS::Check::Test);
7
8
9sub new {
10   	my ($class) 	= shift;
11
12	my ($self) = bless {}, $class;
13
14	if ( @_ ) {
15		$self->_process_args(@_);
16	}
17
18	$self->test(); return $self;
19}
20
21
22sub test()
23{
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 @mx_list = $nsquery->mx_list();
34		my $ns_name	= $nsquery->ns_name();
35
36		$test_detail->{$ns_name}->{desc} = join(' ', @mx_list);
37
38		if ( (scalar @mx_list) > 0 ) {
39			$test_detail->{$ns_name}->{status} = 1;
40		} else {
41			$test_detail->{$ns_name}->{status} = 0;
42			$test_status = 0;
43		}
44	}
45
46
47	$self->{test_status} = $test_status;
48	$self->{test_detail} = $test_detail;
49
50	return $test_status;
51}
52
531;
54
55__END__
56
57=head1 NAME
58
59Net::DNS::Check::Test::mx_present - Check if mx RR is present or not
60
61=head1 SYNOPSIS
62
63C<use Net::DNS::Test::mx_compare>;
64
65=head1 DESCRIPTION
66
67Check if MX RR is present or not
68
69=head1 METHODS
70
71=head1 COPYRIGHT
72
73Copyright (c) 2005 Lorenzo Luconi Trombacchi  - IIT-CNR
74
75All rights reserved.  This program is free software; you may redistribute
76it and/or modify it under the same terms as Perl itself.
77
78=head1 SEE ALSO
79
80L<perl(1)>
81
82=cut
83
84