Check/Test/soa_serial_syntax.pm untested

filter: Statementstmt 0.0% 0 / 37 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 66 CC 4 SCAR 20.1
CC
4
Cov
0%
test
12.0
new
6.0
BEGIN
2.0
CRAP 7.4
1 package Net::DNS::Check::Test::soa_serial_syntax;
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 $test_status = 1;
30 my %compare_hash;
31 my $test_detail = {};
32  
33 foreach my $nsquery ( @{$self->{nsquery}} ) {
34 my $soa_serial = $nsquery->soa_serial();
35 my $ns_name = $nsquery->ns_name();
36  
37 $test_detail->{$ns_name}->{desc} = $soa_serial;
38 if ($soa_serial =~ /([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})/) {
39 my $year = $1;
40 my $month = $2;
41 my $day = $3;
42 my $rev = $4;
43  
44 if ($year > 1900
45 && $month >= 1 && $month <= 12
46 && $day >= 1 && $day <= 31) {
47  
48 $test_detail->{$ns_name}->{status} = 1;
49 } else {
50 $test_detail->{$ns_name}->{status} = 0;
51 $test_status = 0;
52 }
53 } else {
54 $test_status = 0;
55 $test_detail->{$ns_name}->{status} = 0;
56 }
57  
58 }
59  
60 $self->{test_status} = $test_status;
61 $self->{test_detail} = $test_detail;
62  
63 return $test_status;
64 }
65  
66 1;
67  
68 __END__