Subject: | Attributes with empty first line and continuation |
Date: | Fri, 18 May 2007 14:38:13 +0100 |
To: | bug-Net-Whois-RIPE [...] rt.cpan.org |
From: | Dagfinn Ilmari Mannsåker <ilmari [...] ilmari.org> |
Hi,
I'm using Net::Whois::RIPE::Object to parse the entire RIPE database,
but it doesn't handle entries with an empty first line followed by a
continuation line (The value gets added to the attribute before).
Here's a patch to fix this:
--- /usr/share/perl5/Net/Whois/RIPE/Object.pm 2005-10-26 03:05:15.000000000 +0100
+++ ./Net/Whois/RIPE/Object.pm 2007-05-18 14:05:24.000000000 +0100
@@ -92,6 +92,7 @@
$value2 =~ s/\s+$//;
$self->add($precedent_attribute, $value2);
+ $found_record = 1;
} elsif (my ($attribute, $value) = /^([\w\-]+|\*\w\w):\s+(.*)$/) {
$value =~ s/#.*$// unless exists $Free_Form{$attribute};
$value =~ s/\s+$//;
@@ -99,7 +100,8 @@
$self->add($attribute, $value);
$precedent_attribute = $attribute;
$found_record = 1;
- } elsif (/^([\w\-]+|\*\w\w):\s*$/) {
+ } elsif (my ($attr) = /^([\w\-]+|\*\w\w):\s*$/) {
+ $precedent_attribute = $attr;
} else {
$self->_err("unparseable line: '$_'");
}
--
ilmari