SenderBase/Query.pm

filter: Statementstmt 60.7% 17 / 28 Branchbran 25.0% 1 / 4 Conditioncond 0.0% 0 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 83.3% 5 / 6 Podpod 50.0% 1 / 2 totaltotal 47.0% 24 / 51 CC 6 SCAR 26.6
CC
6
Cov
46%
new
25.1
load_module
2.0
BEGIN
1.0
CRAP 14.2
« SenderBase/Query/HTTP.pm ↑ Summary SenderBase/Results.pm »
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
BranchTrueFalseTotal
$attrs{"Address"} or die "No 'Address' attribute in call to new()" 0 1 1
17 0 ▶ if ($attrs{Address} !~ /^\d+\.\d+\.\d+\.\d+$/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($attrs{"Address"} =~ /^\d+\.\d+\.\d+\.\d+$/) 0 0 0
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"
l!l
00
MC/DC0%0/1
gethostbyname $attrs{'Address'} || "\000\000\000\000"
gethostbyname $attrs{'Address'}
Truth table0%0/2
A
A= gethostbyname $attrs{'Address'}
Aresult
11
00
20 }
21  
22 0 ▶ $attrs{Timeout} ||= $TIMEOUT;
Condition0%0/3
$attrs{"Timeout"} ||= $Net::SenderBase::Query::TIMEOUT
l!l&&r!l&&!r
000
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
ABresult
1X1
011
000
23
24 0 ▶ my $type = uc($attrs{Transport}) || 'DNS';
Condition0%0/2
uc $attrs{'Transport'} || 'DNS'
l!l
00
MC/DC0%0/1
uc $attrs{'Transport'} || 'DNS'
uc $attrs{'Transport'}
Truth table0%0/2
A
A= uc $attrs{'Transport'}
Aresult
11
00
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__
« SenderBase/Query/HTTP.pm ↑ Summary SenderBase/Results.pm »