# HG changeset patch # User Heiko Schlittermann (JUMPER) # Date 1421871620 -3600 # Node ID df6ce1a4c43b32a325b37ec84c82ff1d43414cdb # Parent aff0448cbef9144e9304b0c4fab426b8d44979da cope with continuation lines diff -r aff0448cbef9 -r df6ce1a4c43b lib/DNS/Vi.pm --- a/lib/DNS/Vi.pm Wed Jan 21 20:41:45 2015 +0100 +++ b/lib/DNS/Vi.pm Wed Jan 21 21:20:20 2015 +0100 @@ -29,10 +29,20 @@ my @zone; my ($origin, $ttl, $last_label, $soa_seen); + $_ = ''; foreach (@lines) { s{;.*$}{}; # strip trailing comments + state $line; + if (my $range = /(.*)\(\s*$/ .. /(.*)\)\s*/) { + $line .= defined $1 ? $1 : $_; + next unless $range =~ /E0$/; + } + if (defined $line) { + $_ = $line; # accumulated continuation line + $line = undef; + } s{\s*$}{}; # strip off trailing spaces - for ($_) { + given ($_) { when (m{^\s*$}) { next } when (m{^\s*\$ORIGIN\s+(\S+)}) { $origin = $1 } when (m{^\s*\$TTL\s+(\S+)}) { $ttl = $1 } diff -r aff0448cbef9 -r df6ce1a4c43b t/10-dnsvi.t --- a/t/10-dnsvi.t Wed Jan 21 20:41:45 2015 +0100 +++ b/t/10-dnsvi.t Wed Jan 21 21:20:20 2015 +0100 @@ -44,7 +44,9 @@ }, b => { RRSETS => 11, - SOA => 1, + SOA => { + 'km21.de.' => ['pu.schlittermann.de. hostmaster.schlittermann.de. 1397766411 86400 7200 604800 300'], + }, NS => 2, A => 1, TXT => 3, @@ -116,7 +118,7 @@ } else { is grep({ $_->{rrset}{rrtype} eq $type } @zone), - $expect{$type}//0 => "number of $type rrsets\n"; + $expect{$type}//0 => "number of $type rrsets"; } } diff -r aff0448cbef9 -r df6ce1a4c43b t/samples/b --- a/t/samples/b Wed Jan 21 20:41:45 2015 +0100 +++ b/t/samples/b Wed Jan 21 21:20:20 2015 +0100 @@ -1,7 +1,13 @@ $ORIGIN km21.de. $TTL 1d ; do NOT EDIT the SOA records SERIAL number! -@ SOA pu.schlittermann.de. hostmaster.schlittermann.de. 1397766411 86400 7200 604800 300 +@ SOA pu.schlittermann.de. hostmaster.schlittermann.de. ( + 1397766411 ; serial + 86400 ; refresh + 7200 ; retry + 604800 ; expire + 300 ; min ttl + ) NS hh.schlittermann.de. NS pu.schlittermann.de. TXT "invoice: self"