| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Net::DNS::Method; | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | require 5.005_62; | 
| 4 | 6 |  |  | 6 |  | 489216 | use Carp; | 
|  | 6 |  |  |  |  | 15 |  | 
|  | 6 |  |  |  |  | 449 |  | 
| 5 | 6 |  |  | 6 |  | 31 | use strict; | 
|  | 6 |  |  |  |  | 10 |  | 
|  | 6 |  |  |  |  | 198 |  | 
| 6 | 6 |  |  | 6 |  | 41 | use warnings; | 
|  | 6 |  |  |  |  | 9 |  | 
|  | 6 |  |  |  |  | 201 |  | 
| 7 | 6 |  |  | 6 |  | 28 | no strict 'refs'; | 
|  | 6 |  |  |  |  | 8 |  | 
|  | 6 |  |  |  |  | 159 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 | 6 |  |  | 6 |  | 26 | use vars qw/$AUTOLOAD/; | 
|  | 6 |  |  |  |  | 12 |  | 
|  | 6 |  |  |  |  | 261 |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 | 6 |  |  | 6 |  | 36 | use File::Find; | 
|  | 6 |  |  |  |  | 14 |  | 
|  | 6 |  |  |  |  | 400 |  | 
| 12 |  |  |  |  |  |  |  | 
| 13 | 6 |  |  | 6 |  | 41 | use constant NS_FAIL	=> 0x00; | 
|  | 6 |  |  |  |  | 11 |  | 
|  | 6 |  |  |  |  | 390 |  | 
| 14 | 6 |  |  | 6 |  | 28 | use constant NS_OK	=> 0x01; | 
|  | 6 |  |  |  |  | 11 |  | 
|  | 6 |  |  |  |  | 299 |  | 
| 15 | 6 |  |  | 6 |  | 28 | use constant NS_STOP	=> 0x02; | 
|  | 6 |  |  |  |  | 9 |  | 
|  | 6 |  |  |  |  | 231 |  | 
| 16 | 6 |  |  | 6 |  | 81 | use constant NS_IGNORE 	=> 0x04; | 
|  | 6 |  |  |  |  | 12 |  | 
|  | 6 |  |  |  |  | 247 |  | 
| 17 | 6 |  |  | 6 |  | 28 | use constant NS_SPLIT 	=> 0x08; | 
|  | 6 |  |  |  |  | 9 |  | 
|  | 6 |  |  |  |  | 3091 |  | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | require Exporter; | 
| 20 |  |  |  |  |  |  | our @ISA = qw(Exporter); | 
| 21 |  |  |  |  |  |  | our @EXPORT = qw( | 
| 22 |  |  |  |  |  |  | NS_OK | 
| 23 |  |  |  |  |  |  | NS_FAIL | 
| 24 |  |  |  |  |  |  | NS_STOP | 
| 25 |  |  |  |  |  |  | NS_IGNORE | 
| 26 |  |  |  |  |  |  | NS_SPLIT | 
| 27 |  |  |  |  |  |  | ); | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | our $VERSION = '2.00'; | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | sub new { | 
| 32 | 0 |  |  | 0 | 0 |  | croak | 
| 33 |  |  |  |  |  |  | "Net::DNS::Method is meant as a base class. Do not use it directly.\n"; | 
| 34 |  |  |  |  |  |  | } | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | ## The AUTOLOAD below, handles the creation of methods that are to be defined | 
| 37 |  |  |  |  |  |  | ## to answer for each known RR type in Net::DNS. | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | sub AUTOLOAD { | 
| 40 | 0 |  |  | 0 |  |  | my $sub = $AUTOLOAD; | 
| 41 | 0 |  |  |  |  |  | $sub =~ s/.*:://; | 
| 42 | 0 |  |  | 0 |  |  | *$sub = sub { NS_FAIL; }; | 
|  | 0 |  |  |  |  |  |  | 
| 43 | 0 |  |  |  |  |  | goto &$sub; | 
| 44 |  |  |  |  |  |  | } | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | ## The call to ANY will cause all the methods to be created. | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | my @RR = (); | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | sub ANY { | 
| 51 | 0 |  |  | 0 | 0 |  | my $self = shift; | 
| 52 | 0 |  |  |  |  |  | my $q = $_[0]; | 
| 53 | 0 |  |  |  |  |  | my $ans = $_[1]; | 
| 54 |  |  |  |  |  |  |  | 
| 55 | 0 | 0 |  |  |  |  | unless (@RR) { | 
| 56 |  |  |  |  |  |  | find( { no_chdir => 1, | 
| 57 |  |  |  |  |  |  | wanted => sub { | 
| 58 | 0 |  | 0 | 0 |  |  | my $file = m/(\w+)\.pm$/ && $1; | 
| 59 |  |  |  |  |  |  | return undef | 
| 60 | 0 | 0 |  |  |  |  | unless $File::Find::dir =~ m!Net/DNS[^\w]!; | 
| 61 | 0 | 0 |  |  |  |  | push @RR, $file if $file; | 
| 62 |  |  |  |  |  |  | } | 
| 63 | 0 |  |  |  |  |  | }, grep { -d } @INC); | 
|  | 0 |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | } | 
| 65 |  |  |  |  |  |  |  | 
| 66 | 0 |  |  |  |  |  | my $ret = NS_FAIL; | 
| 67 |  |  |  |  |  |  |  | 
| 68 | 0 |  |  |  |  |  | for my $r (@RR) { | 
| 69 | 0 |  |  |  |  |  | $ret |= $self->$r(@_); | 
| 70 |  |  |  |  |  |  | } | 
| 71 |  |  |  |  |  |  |  | 
| 72 | 0 | 0 | 0 |  |  |  | if (!($ret & NS_OK) | 
| 73 |  |  |  |  |  |  | and $ans->header->rcode eq 'NOERROR') | 
| 74 |  |  |  |  |  |  | { | 
| 75 | 0 |  |  |  |  |  | $ans->header->rcode('NXDOMAIN'); | 
| 76 |  |  |  |  |  |  | } | 
| 77 |  |  |  |  |  |  |  | 
| 78 | 0 |  |  |  |  |  | return $ret; | 
| 79 |  |  |  |  |  |  | } | 
| 80 |  |  |  |  |  |  |  | 
| 81 |  |  |  |  |  |  | 1; | 
| 82 |  |  |  |  |  |  | __END__ |