Net::DNS patch

Matts on 2002-06-19T12:03:55

Net::DNS makes SpamAssassin slow, because it uses $'. Here's a patch for that:

@@ -198,31 +156,28 @@
        my ($class, $rrstring, $update_type) = @_;
        my ($s, %self, $retval);

- my $name = undef; + my $name = ""; my $ttl = 0; my $rrclass = ""; my $rrtype = ""; my $rdata = "";

- while ($rrstring =~ /\s*(\S+)\s*/g) { - $s = $1; + my @matches = $rrstring =~ /\s*(\S+)\s*/g; + while (defined($s = shift @matches)) {

- if (!defined($name)) { - #($name = $s) =~ s/\.+$//; - $name = $s; - $name =~ s/^\.+//; - $name =~ s/\.+$//; + if (!$name) { + ($name = $s) =~ s/\.+$//; } elsif ($s =~ /^\d+$/) { $ttl = $s; } elsif (!$rrclass && exists $Net::DNS::classesbyname{uc($s)}) { - $rrclass = uc($s); - $rdata = $'; # in case this is really type=ANY + $rrclass = $s; + $rdata = join(' ', @matches); # in case this is really type=ANY } elsif (exists $Net::DNS::typesbyname{uc($s)}) { - $rrtype = uc($s); - $rdata = $'; + $rrtype = $s; + $rdata = join(' ', @matches); last; } else {


Ooo...

triv on 2002-06-19T20:22:29

(This might have gotten posted twice, I'm not sure. If it is a dup, sorry.)

You should email me that patch, I'll put it in for the next CPAN release. (I'd grab it right off your journal, but it's not a full patch.)

Re:Ooo...

triv on 2002-06-20T05:01:41

The patch actually broke SOA parsing. whoops. A modified version of this will be in the next CPAN release.