| 1 | # $Id: Query.pm,v 1.3 2003/07/04 15:44:34 matt Exp $ | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | package Net::SenderBase::Query; | ||||||||||||||||||||
| 4 | 4 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 4 | ▶ | use vars qw($TIMEOUT); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 4 | ▶ | use Net::SenderBase::Results; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 4 | ▶ | use Socket; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | 4 | $TIMEOUT = 10; | |||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | 1 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=6 SCAR=32.2
Pod
documented
| |||||||||||||||||||||
| 13 | 1 | my $class = shift; | |||||||||||||||||||
| 14 | 1 | my %attrs = @_; | |||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | 1 | ▶ | $attrs{Address} || die "No 'Address' attribute in call to new()"; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 17 | 0 | ▶ | if ($attrs{Address} !~ /^\d+\.\d+\.\d+\.\d+$/) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 18 | # assume it is a hostname instead of an IP | ||||||||||||||||||||
| 19 | 0 | ▶ | $attrs{Address} = inet_ntoa(scalar(gethostbyname($attrs{Address})||pack("N", 0))); | ||||||||||||||||||
|
Condition0%0/2
gethostbyname $attrs{'Address'} || "\000\000\000\000"
MC/DC0%0/1
gethostbyname $attrs{'Address'} || "\000\000\000\000"
gethostbyname $attrs{'Address'}
Truth table0%0/2
A
A= gethostbyname $attrs{'Address'}
| |||||||||||||||||||||
| 20 | } | ||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | 0 | ▶ | $attrs{Timeout} ||= $TIMEOUT; | ||||||||||||||||||
|
Condition0%0/3
$attrs{"Timeout"} ||= $Net::SenderBase::Query::TIMEOUT
MC/DC0%0/2
$attrs{"Timeout"} ||= $Net::SenderBase::Query::TIMEOUT
$attrs{"Timeout"}
$Net::SenderBase::Query::TIMEOUT
Truth table0%0/3
A ||= B
A= $attrs{"Timeout"}B= $Net::SenderBase::Query::TIMEOUT
| |||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | 0 | ▶ | my $type = uc($attrs{Transport}) || 'DNS'; | ||||||||||||||||||
|
Condition0%0/2
uc $attrs{'Transport'} || 'DNS'
MC/DC0%0/1
uc $attrs{'Transport'} || 'DNS'
uc $attrs{'Transport'}
Truth table0%0/2
A
A= uc $attrs{'Transport'}
| |||||||||||||||||||||
| 25 | 0 | my $query_class = "${class}::${type}"; | |||||||||||||||||||
| 26 | 0 | load_module($query_class); | |||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | 0 | return $query_class->new(%attrs); | |||||||||||||||||||
| 29 | } | ||||||||||||||||||||
| 30 | |||||||||||||||||||||
| 31 | 0 | ▶ | sub load_module { | ||||||||||||||||||
|
Subroutine
load_module: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 32 | 0 | my $module = shift; | |||||||||||||||||||
| 33 | 0 | $module =~ s/::/\//g; | |||||||||||||||||||
| 34 | 0 | $module .= ".pm"; | |||||||||||||||||||
| 35 | 0 | require $module; | |||||||||||||||||||
| 36 | } | ||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 4 | 1; | |||||||||||||||||||
| 39 | __END__ | ||||||||||||||||||||