line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::DNS::Resolver::UNIX; |
2
|
|
|
|
|
|
|
|
3
|
90
|
|
|
90
|
|
734
|
use strict; |
|
90
|
|
|
|
|
196
|
|
|
90
|
|
|
|
|
2547
|
|
4
|
90
|
|
|
90
|
|
441
|
use warnings; |
|
90
|
|
|
|
|
168
|
|
|
90
|
|
|
|
|
4199
|
|
5
|
|
|
|
|
|
|
our $VERSION = (qw$Id: UNIX.pm 1856 2021-12-02 14:36:25Z willem $)[2]; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Net::DNS::Resolver::UNIX - Unix resolver class |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=cut |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
90
|
|
|
90
|
|
543
|
use base qw(Net::DNS::Resolver::Base); |
|
90
|
|
|
|
|
189
|
|
|
90
|
|
|
|
|
51997
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my @config_file = grep { -f $_ && -r _ } '/etc/resolv.conf'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my $dotfile = '.resolv.conf'; |
21
|
|
|
|
|
|
|
my @dotpath = grep {defined} $ENV{HOME}, '.'; |
22
|
|
|
|
|
|
|
my @dotfile = grep { -f $_ && -o _ } map {"$_/$dotfile"} @dotpath; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
local $ENV{PATH} = join ':', grep {$_} qw(/bin /usr/bin), $ENV{PATH}; |
26
|
|
|
|
|
|
|
my $uname = eval {`uname -n 2>/dev/null`} || ''; |
27
|
|
|
|
|
|
|
chomp $uname; |
28
|
|
|
|
|
|
|
my ( $host, @domain ) = split /\./, $uname, 2; |
29
|
|
|
|
|
|
|
__PACKAGE__->domain(@domain); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub _init { |
33
|
8
|
|
|
8
|
|
49
|
my $defaults = shift->_defaults; |
34
|
|
|
|
|
|
|
|
35
|
8
|
|
|
|
|
83
|
$defaults->_read_config_file($_) foreach @config_file; |
36
|
|
|
|
|
|
|
|
37
|
8
|
|
|
|
|
88
|
%$defaults = Net::DNS::Resolver::Base::_untaint(%$defaults); |
38
|
|
|
|
|
|
|
|
39
|
8
|
|
|
|
|
77
|
$defaults->_read_config_file($_) foreach @dotfile; |
40
|
|
|
|
|
|
|
|
41
|
8
|
|
|
|
|
56
|
$defaults->_read_env; |
42
|
8
|
|
|
|
|
15
|
return; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
__END__ |