lib/DNS/Vi.pm
changeset 66 04e08079f218
parent 65 0f7e871c4672
child 67 760a2752983c
equal deleted inserted replaced
65:0f7e871c4672 66:04e08079f218
    23 #       $data - a long string with the zone data
    23 #       $data - a long string with the zone data
    24 sub parse {
    24 sub parse {
    25     my %arg   = %{ pop @_ } if ref $_[-1] eq 'HASH';
    25     my %arg   = %{ pop @_ } if ref $_[-1] eq 'HASH';
    26     my $data  = shift;
    26     my $data  = shift;
    27     my @lines = split /\n/, $data;
    27     my @lines = split /\n/, $data;
    28 
       
    29     ### @lines
       
    30 
    28 
    31     my @zone;
    29     my @zone;
    32     my ($origin, $ttl, $last_label, $soa_seen);
    30     my ($origin, $ttl, $last_label, $soa_seen);
    33 
    31 
    34     $_ = '';
    32     $_ = '';
    99                           unless substr($rrset{data}, -1) eq '.';
    97                           unless substr($rrset{data}, -1) eq '.';
   100                     }
    98                     }
   101                 }
    99                 }
   102                 my $id = sha512_hex(join "\0", sort %rrset);
   100                 my $id = sha512_hex(join "\0", sort %rrset);
   103                 push @zone, { id => $id, rrset => \%rrset };
   101                 push @zone, { id => $id, rrset => \%rrset };
       
   102 		### x: $zone[-1]
   104             }
   103             }
   105         }
   104         }
   106     }
   105     }
   107 
   106 
   108     # list of {
       
   109     #	id => $id,
       
   110     #	rrset => { label => …, ttl => …, rrtype => …, data => … }
       
   111     # }
       
   112     ### @zone
       
   113     return @zone;
   107     return @zone;
   114 }
   108 }
   115 
   109 
   116 sub ttl2h {
   110 sub ttl2h {
   117     my $seconds = shift;
   111     my $seconds = shift;