Net::DNS::Method - Base class for Net::DNS::Server methods
use Net::DNS::Method; package Net::DNS::Method::Sample; our @ISA = qw( ... Net::DNS::Method ... ); sub new { ... } sub A { ... }
This is a base class to help in the creation of method classes for use within the Net::DNS::Server package. This class provides specific methods to do nothing to particular DNS questions. In general, this class consists of a number of methods that are called like in the following example.
->A($q, $ans)
This would be invoked by Net::DNS::Server upon the arrival of a query of type 'A'.
The method can check the question, passed as a Net::DNS::Qustion object in $q. Usually, the method will then modify the Net::DNS::Packet object in $ans to provide an answer.
$q
$ans
Net::DNS::Server will call sequentially all of the registered Net::DNS::Method::* objects for a given question. After this sequence of calls ends, the response can be sent depending on what the methods have requsted.
The return value of the method is given as an OR of the following values.
NS_IGNORE
Requests that the current question be ignored.
NS_STOP
Requests that no further objects be invoked.
NS_OK
Indicates that the current method matched the question and presumably, altered the answer. Control is passed to the next method in sequence. After the last method is invoked, the answer will be sent to the client unless NS_IGNORE is returned by this or a later method.
NS_FAIL
Indicates that the current method did not match the packet.
NS_SPLIT
Indicates that the response must be splitted in individual answers and sent accordingly. This is used for AXFR requests.
There is one such method for each type of RR supported by Net::DNS. Additionally, the ->ANY method is provided, which calls all the defined RRs in succession.
->ANY
NS_* constants used for the return values.
$Id: Method.pm,v 1.2 2002/10/23 04:43:58 lem Exp $
original version; created by h2xs 1.20 with options -Xfn Net::DNS::Method -v 1.00
Added ->ANY to do the expected thing (ie, evoke all the available data). Implementors might want to override the supplied definition to be a bit more efficient.
Modified ->AXFR so that the same thing that ->AXFR happens by default.
Added NS_SPLIT.
->AXFR does not work reliably, so 1.20 was undone.
->ANY fixes the rcode depending on success/failure of the modules.
Started work to prepare a public distribution
Luis E. Munoz <luismunoz@cpan.org>
perl(1), Net::DNS(3), Net::DNS::Server(3), Net::DNS::Question(3), Net::DNS::Packet(3).
To install Net::DNS::Method, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::DNS::Method
CPAN shell
perl -MCPAN -e shell install Net::DNS::Method
For more information on module installation, please visit the detailed CPAN module installation guide.