line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::DNS::Resolver::UNIX; |
2
|
|
|
|
|
|
|
|
3
|
90
|
|
|
90
|
|
762
|
use strict; |
|
90
|
|
|
|
|
220
|
|
|
90
|
|
|
|
|
2596
|
|
4
|
90
|
|
|
90
|
|
439
|
use warnings; |
|
90
|
|
|
|
|
193
|
|
|
90
|
|
|
|
|
4294
|
|
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
|
|
551
|
use base qw(Net::DNS::Resolver::Base); |
|
90
|
|
|
|
|
224
|
|
|
90
|
|
|
|
|
55968
|
|
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
|
|
46
|
my $defaults = shift->_defaults; |
34
|
|
|
|
|
|
|
|
35
|
8
|
|
|
|
|
76
|
$defaults->_read_config_file($_) foreach @config_file; |
36
|
|
|
|
|
|
|
|
37
|
8
|
|
|
|
|
98
|
%$defaults = Net::DNS::Resolver::Base::_untaint(%$defaults); |
38
|
|
|
|
|
|
|
|
39
|
8
|
|
|
|
|
105
|
$defaults->_read_config_file($_) foreach @dotfile; |
40
|
|
|
|
|
|
|
|
41
|
8
|
|
|
|
|
112
|
$defaults->_read_env; |
42
|
8
|
|
|
|
|
18
|
return; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
__END__ |