| 1 | package Net::DNS::Method::Regexp; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | require 5.005_62; | |||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use Net::DNS::Method; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use vars qw($VERSION @ISA $AUTOLOAD); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 2 | $VERSION = '2.00'; | |||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | our $DEBUG = 0; | |||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 2 | our @ISA = qw(Net::DNS::Method); | |||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=15.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | my $type = shift; | |||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | ▶ | my $class = ref($type) || $type || "Net::DNS::Method::Regexp"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
ref $type || $type || 'Net::DNS::Method::Regexp'
ref $type or $type
MC/DC0%0/2
ref $type || $type || 'Net::DNS::Method::Regexp'
ref $type
$type
Truth table33%1/3
A or B
A= ref $typeB= $type
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | my $ref = shift; | |||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 1 | ▶ | croak "Missing initialization parameters\n" unless ref($ref) eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 1 | return bless { ref => $ref }, $class; | |||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | ▶ | sub ANY { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ANY: not called CC=25 SCAR=64.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | my $q = shift; | |||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | my $ans = shift; | |||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | warn "inside ANY" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | return NS_FAIL unless $self and $q and $ans; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$self and $q and $ans
$self and $q
MC/DC0%0/3
$self and $q and $ans
$self
$q
$ans
Truth table0%0/4
A and B and C
A= $selfB= $qC= $ans
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | my $qs = $q->qname . ' ' . $q->qclass . ' ' . $q->qtype; | |||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | for my $re (sort { length $b <=> length $a } keys %{$self->{ref}}) { | |||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | if ($qs =~ /$re/ix) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | { | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | warn "match on $re for question $qs" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | my $s = $self->{ref}->{$re}; | |||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | # First, push RRs in the corresponding zones | ||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | for my $z (qw(answer authority additional question)) { | |||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | next unless exists $s->{$z} and defined $s->{$z}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $s->{$z} and defined $s->{$z}
MC/DC0%0/2
exists $s->{$z} and defined $s->{$z}
exists $s->{$z}
defined $s->{$z}
Truth table0%0/3
A and B
A= exists $s->{$z}B= defined $s->{$z}
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | croak "$re->$z must be undef or an array reference" | ||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | ▶ | unless ref($s->{$z}) eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | for my $rr (@{$s->{$z}}) { | |||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | $ans->safe_push($z, $rr); | |||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | # Next, set the answer bits to the requested | ||||||||||||||||||||||||||||||||||||||||||
| 58 | # values | ||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | $ans->header->ra($s->{ra}) | ||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | if exists $s->{ra} and defined $s->{ra}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $s->{"ra"} and defined $s->{"ra"}
MC/DC0%0/2
exists $s->{"ra"} and defined $s->{"ra"}
exists $s->{"ra"}
defined $s->{"ra"}
Truth table0%0/3
A and B
A= exists $s->{"ra"}B= defined $s->{"ra"}
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | $ans->header->rd($s->{rd}) | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | if exists $s->{rd} and defined $s->{rd}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $s->{"rd"} and defined $s->{"rd"}
MC/DC0%0/2
exists $s->{"rd"} and defined $s->{"rd"}
exists $s->{"rd"}
defined $s->{"rd"}
Truth table0%0/3
A and B
A= exists $s->{"rd"}B= defined $s->{"rd"}
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | $ans->header->aa($s->{aa}) | ||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | if exists $s->{aa} and defined $s->{aa}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $s->{"aa"} and defined $s->{"aa"}
MC/DC0%0/2
exists $s->{"aa"} and defined $s->{"aa"}
exists $s->{"aa"}
defined $s->{"aa"}
Truth table0%0/3
A and B
A= exists $s->{"aa"}B= defined $s->{"aa"}
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | $ans->header->tc($s->{tc}) | ||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | if exists $s->{tc} and defined $s->{tc}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $s->{"tc"} and defined $s->{"tc"}
MC/DC0%0/2
exists $s->{"tc"} and defined $s->{"tc"}
exists $s->{"tc"}
defined $s->{"tc"}
Truth table0%0/3
A and B
A= exists $s->{"tc"}B= defined $s->{"tc"}
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | # Next, set the answer's result code | ||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | if (exists $s->{code} and defined $s->{code}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $s->{"code"} and defined $s->{"code"}
MC/DC0%0/2
exists $s->{"code"} and defined $s->{"code"}
exists $s->{"code"}
defined $s->{"code"}
Truth table0%0/3
A and B
A= exists $s->{"code"}B= defined $s->{"code"}
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | $ans->header->rcode($s->{code}); | |||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||
| 77 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | $ans->header->rcode('NOERROR'); | |||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | # Finally, return the requested value or our | ||||||||||||||||||||||||||||||||||||||||||
| 82 | # default | ||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | if (exists $s->{return} and defined $s->{return}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $s->{"return"} and defined $s->{"return"}
MC/DC0%0/2
exists $s->{"return"} and defined $s->{"return"}
exists $s->{"return"}
defined $s->{"return"}
Truth table0%0/3
A and B
A= exists $s->{"return"}B= defined $s->{"return"}
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | return $s->{return}; | |||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||
| 87 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | return NS_OK | NS_STOP; | |||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | return NS_FAIL; | |||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | 1 | ▶ | sub AUTOLOAD { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
AUTOLOAD: called CC=3 SCAR=18.4
| |||||||||||||||||||||||||||||||||||||||||||
| 96 | 1 | ▶ | return undef if $AUTOLOAD eq 'Net::DNS::Method::Regexp::DESTROY'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | warn "call to $AUTOLOAD" if $DEBUG; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | goto &ANY; | |||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 104 | __END__ | ||||||||||||||||||||||||||||||||||||||||||