Net::DNSServer::Base

This is meant to be the base class for all resolving module handlers.
Download

Net::DNSServer::Base Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Rob Brown
  • Publisher web site:
  • http://karmatics.com/aardvark/

Net::DNSServer::Base Tags


Net::DNSServer::Base Description

This is meant to be the base class for all resolving module handlers. Net::DNSServer::Base is a Perl module meant to be the base class for all resolving module handlers.SYNOPSISExample Usage: #!/usr/bin/perl -w -T use strict; use Net::DNSServer; use Net::DNSServer::Cache; use MyTestResolver; my $resolver1 = new Net::DNSServer::Cache; my $resolver2 = new MyTestResolver {dom => "test.com"}; run Net::DNSServer { priority => , }; # Never returnsExample MyTestResolver.pm Contents: package MyTestResolver; use strict; use Exporter; use Net::DNSServer::Base; use Net::DNS::Packet; use vars qw(@ISA); @ISA = qw(Net::DNSServer::Base); # resolve subroutine must be defined sub resolve { my $self = shift; my $dns_packet = $self -> {question}; my ($question) = $dns_packet -> question(); if ($question -> qname eq $self->{dom} && $question -> qtype eq "A") { my $response = bless \%{$dns_packet}, "Net::DNS::Packet" || die "Could not initialize response packet"; $response->push("answer", ); $response->push("authority", ); $response->push("additional", ); my $response_header = $response->header; $response_header->aa(1); # Make Authoritative return $response; } return undef; }The main invoker program should call the new() method for each resolver to create an instance of each. Each resolver ISA Net::DNSServer::Base which must explicitly define a resolve() method. A reference to a list of these objects is passed to run() as the "priority" argument as demonstrated in the SYNOPSIS above. Net::DNSServer->run() never returns. Requirements: · Perl


Net::DNSServer::Base Related Software