Subject: | Net::DNS::Nameserver: NotifyHandler required but not documented |
Hi,
the documentation says that for a Net::DNS::Nameserver, only the
ReplyHandler is required. However, when not specifying a NotifyHandler,
I get the following error at runtime whenever somebody sends the
nameserver a notify packet:
Can't use string ("") as a subroutine ref while "strict refs" in use at
/usr/lib/perl5/Net/DNS/Nameserver.pm line 196.
This is obvious due to the code, which unconditionally calls the
NotifyHandler coderef:
if ($query->header->opcode eq "QUERY"){
($rcode, $ans, $auth, $add, $headermask) =
&{$self->{"ReplyHandler"}}($qname,
$qclass, $qtype, $peerhost, $query, $conn);
}else{
$reply->header->rcode("SERVFAIL") unless
( ref $self->{"NotifyHandler"} eq "CODE");
($rcode, $ans, $auth, $add, $headermask) =
&{$self->{"NotifyHandler"}}($qname,
$qclass, $qtype, $peerhost, $query, $conn);
}
So, either the code needs to be changed to not call the coderef if it’s
not set, or the documentation needs to be updated :-).
Best regards,
Michael