Fixed the parser pattern.
Now even a single space is enough at the start of continuation lines.
--- a/lib/DNS/Vi.pm Thu Nov 13 22:23:04 2014 +0100
+++ b/lib/DNS/Vi.pm Thu Nov 13 23:03:38 2014 +0100
@@ -27,9 +27,9 @@
when (m{^\s*\$ORIGIN\s+(\S+)}) { $origin = $1 }
when (m{^\s*\$TTL\s+(\S+)}) { $ttl = $1 }
when (
- m{^(?<label>\S+)?
- \s+(?<ttl>\d[\dwdmhs]*(?=\s+))?
- \s+(?:(?:IN|ANY)\s+)?(?<rrtype>[a-z]\S*(?=\s+))
+ m{^(?:(?<label>\S+)(?=\s))?
+ (?:\s+(?<ttl>\d[\dwdmhs]*(?=\s+)))?
+ (?:\s+(?:(?:IN|ANY)\s+)?(?<rrtype>[a-z]\S*(?=\s+)))
\s+(?<data>.*)
}ix
)
--- a/t/10-dnsvi.t Thu Nov 13 22:23:04 2014 +0100
+++ b/t/10-dnsvi.t Thu Nov 13 23:03:38 2014 +0100
@@ -28,6 +28,7 @@
A => 6,
TXT => 3,
AAAA => 1,
+ MX => 5,
},
a => {
RRSETS => 32,
@@ -36,6 +37,7 @@
A => 9,
TXT => 4,
AAAA => 0,
+ MX => 0,
},
b => {
RRSETS => 7,
@@ -44,6 +46,16 @@
A => 1,
TXT => 3,
AAAA => 0,
+ MX => 0,
+ },
+ c => {
+ RRSETS => 12,
+ SOA => 1,
+ NS => 2,
+ A => 2,
+ TXT => 5,
+ AAAA => 0,
+ MX => 2,
},
);
@@ -54,7 +66,7 @@
grep { $_ ne 'RRSETS' } sort keys %h;
};
-foreach my $sample (keys %result) {
+foreach my $sample (sort keys %result) {
my $file = "t/samples/$sample";
subtest "sample $file" => sub {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/t/samples/c Thu Nov 13 23:03:38 2014 +0100
@@ -0,0 +1,16 @@
+$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
+ NS hh.schlittermann.de.
+ NS pu.schlittermann.de.
+ TXT "invoice: self"
+ TXT "utf8: km21.de"
+ TXT "start: 1396981300 2014-04-08T20:21:40"
+tte A 85.214.245.1
+ IN A 1.1.1.1
+ TXT "tte"
+; only one space
+ IN TXT "tte2"
+ IN MX 10 mexico.
+ IN MX 20 mx20.