line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: Query.pm,v 1.3 2003/07/04 15:44:34 matt Exp $ |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Net::SenderBase::Query; |
4
|
4
|
|
|
4
|
|
74
|
use strict; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
139
|
|
5
|
4
|
|
|
4
|
|
28
|
use vars qw($TIMEOUT); |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
191
|
|
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
2533
|
use Net::SenderBase::Results; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
114
|
|
8
|
4
|
|
|
4
|
|
4173
|
use Socket; |
|
4
|
|
|
|
|
19585
|
|
|
4
|
|
|
|
|
3702
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
$TIMEOUT = 10; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
1
|
|
|
1
|
1
|
14
|
my $class = shift; |
14
|
1
|
|
|
|
|
4
|
my %attrs = @_; |
15
|
|
|
|
|
|
|
|
16
|
1
|
50
|
|
|
|
16
|
$attrs{Address} || die "No 'Address' attribute in call to new()"; |
17
|
0
|
0
|
|
|
|
|
if ($attrs{Address} !~ /^\d+\.\d+\.\d+\.\d+$/) { |
18
|
|
|
|
|
|
|
# assume it is a hostname instead of an IP |
19
|
0
|
|
0
|
|
|
|
$attrs{Address} = inet_ntoa(scalar(gethostbyname($attrs{Address})||pack("N", 0))); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
0
|
|
|
|
$attrs{Timeout} ||= $TIMEOUT; |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
0
|
|
|
|
my $type = uc($attrs{Transport}) || 'DNS'; |
25
|
0
|
|
|
|
|
|
my $query_class = "${class}::${type}"; |
26
|
0
|
|
|
|
|
|
load_module($query_class); |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
return $query_class->new(%attrs); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub load_module { |
32
|
0
|
|
|
0
|
0
|
|
my $module = shift; |
33
|
0
|
|
|
|
|
|
$module =~ s/::/\//g; |
34
|
0
|
|
|
|
|
|
$module .= ".pm"; |
35
|
0
|
|
|
|
|
|
require $module; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
__END__ |