Check/Test/soa_expire_range.pm untested

filter: Statementstmt 0.0% 0 / 34 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 58 CC 5 SCAR 24.8
CC
5
Cov
0%
test
20.0
new
6.0
BEGIN
2.0
CRAP 12.0
1 package Net::DNS::Check::Test::soa_expire_range;
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  
24 sub test() {
25 my ($self) = shift;
26  
27 return unless ( $self->{config} );
28  
29 my $soa_min_expire = $self->{config}->soa_min_expire();
30 my $soa_max_expire = $self->{config}->soa_max_expire();
31  
32 my $test_status = 1;
33 my $test_detail = {};
34  
35 foreach my $nsquery ( @{$self->{nsquery}} ) {
36 my $soa_expire = scalar $nsquery->soa_expire();
37 my $ns_name = $nsquery->ns_name();
38
39 if ($soa_min_expire > 0 && $soa_expire < $soa_min_expire ) {
40 $test_status = 0;
41 $test_detail->{$ns_name}->{status} = 0;
42 } elsif ($soa_max_expire > 0 && $soa_expire > $soa_max_expire ) {
43 $test_status = 0;
44 $test_detail->{$ns_name}->{status} = 0;
45 } else {
46 $test_detail->{$ns_name}->{status} = 1;
47 }
48 $test_detail->{$ns_name}->{desc} = "$soa_expire";
49 }
50  
51 $self->{test_status} = $test_status;
52 $self->{test_detail} = $test_detail;
53  
54 return $test_status;
55 }
56  
57 1;
58  
59 __END__