line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::DNS::Method::Constant; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
1587
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
57
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
43
|
|
5
|
2
|
|
|
2
|
|
1225
|
use Net::DNS; |
|
2
|
|
|
|
|
74451
|
|
|
2
|
|
|
|
|
188
|
|
6
|
2
|
|
|
2
|
|
12
|
use Net::DNS::Method; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
100
|
|
7
|
2
|
|
|
2
|
|
9
|
use vars qw($VERSION @ISA $AUTOLOAD); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
896
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
@ISA = qw(Net::DNS::Method); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
$VERSION = '2.00'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
14
|
2
|
|
|
2
|
0
|
2918
|
my $type = shift; |
15
|
2
|
|
50
|
|
|
20
|
my $class = ref($type) || $type || "Net::DNS::Method::Constant"; |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
|
|
17
|
my $self = |
18
|
|
|
|
|
|
|
{ |
19
|
|
|
|
|
|
|
zone => lc shift, |
20
|
|
|
|
|
|
|
class => uc shift, |
21
|
|
|
|
|
|
|
type => uc shift, |
22
|
|
|
|
|
|
|
rr => shift |
23
|
|
|
|
|
|
|
}; |
24
|
|
|
|
|
|
|
|
25
|
2
|
|
|
|
|
10
|
$self->{zone} =~ s/\.+$//; |
26
|
|
|
|
|
|
|
|
27
|
2
|
|
|
|
|
8
|
bless $self, $class; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _match { |
31
|
10
|
|
|
10
|
|
473
|
my $q = lc shift; |
32
|
10
|
|
|
|
|
11
|
my $d = shift; |
33
|
|
|
|
|
|
|
|
34
|
10
|
|
|
|
|
31
|
$q =~ s/\.+$//; |
35
|
|
|
|
|
|
|
|
36
|
10
|
|
|
|
|
31
|
my $pos = index($q, $d); |
37
|
|
|
|
|
|
|
|
38
|
10
|
100
|
|
|
|
34
|
return 1 if $q eq $d; |
39
|
7
|
50
|
66
|
|
|
27
|
return 1 if $pos == 0 and (length($q) <= length($d)); |
40
|
7
|
100
|
|
|
|
65
|
return 1 if substr($q, $pos - 1, 1) eq '.'; |
41
|
2
|
|
|
|
|
9
|
return 0; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub ANY { |
45
|
10
|
|
|
10
|
0
|
1341
|
my $self = shift; |
46
|
10
|
|
|
|
|
11
|
my $q = shift; |
47
|
10
|
|
|
|
|
11
|
my $ans = shift; |
48
|
|
|
|
|
|
|
|
49
|
10
|
100
|
33
|
|
|
30
|
if ($q->qclass eq $self->{class} |
|
|
|
33
|
|
|
|
|
|
|
|
66
|
|
|
|
|
50
|
|
|
|
|
|
|
and ($q->qtype eq $self->{type} |
51
|
|
|
|
|
|
|
or $q->qtype eq 'ANY') |
52
|
|
|
|
|
|
|
and _match($q->qname, $self->{zone})) |
53
|
|
|
|
|
|
|
{ |
54
|
8
|
|
|
|
|
23
|
my $rr = new Net::DNS::RR $q->qname . ' ' .$self->{rr}; |
55
|
8
|
50
|
|
|
|
1015
|
if ($rr) { |
56
|
8
|
|
|
|
|
26
|
$ans->push('answer', $rr); |
57
|
8
|
|
|
|
|
253
|
$ans->header->rcode('NOERROR'); |
58
|
8
|
|
|
|
|
3761
|
$ans->header->aa(1); |
59
|
8
|
|
|
|
|
130
|
return NS_OK | NS_STOP; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
0
|
warn "Net::DNS::Method::Constant failed to produce an RR to answer ", |
63
|
|
|
|
|
|
|
$q->qname, "\n"; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
} |
66
|
2
|
|
|
|
|
6
|
return NS_FAIL; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub AUTOLOAD { |
70
|
2
|
|
|
2
|
|
11
|
no strict 'refs'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
278
|
|
71
|
1
|
|
|
1
|
|
904
|
my $sub = $AUTOLOAD; |
72
|
1
|
|
|
|
|
6
|
$sub =~ s/.*:://; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# Insure that the called method has an all |
75
|
|
|
|
|
|
|
# uppercase name. This avoids any clash with |
76
|
|
|
|
|
|
|
# future extensions for these handlers, which |
77
|
|
|
|
|
|
|
# will use mixed case or lowercase. |
78
|
|
|
|
|
|
|
|
79
|
1
|
50
|
|
|
|
8
|
return NS_FAIL unless $sub eq uc $sub; |
80
|
1
|
50
|
|
|
|
4
|
return undef if $sub eq 'DESTROY'; |
81
|
|
|
|
|
|
|
|
82
|
1
|
|
|
9
|
|
5
|
*$sub = sub { ANY @_; }; |
|
9
|
|
|
|
|
6875
|
|
83
|
1
|
|
|
|
|
6
|
goto &$sub; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
1; |
87
|
|
|
|
|
|
|
__END__ |