line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::DNS::Resolver::UNIX; |
2
|
|
|
|
|
|
|
|
3
|
90
|
|
|
90
|
|
837
|
use strict; |
|
90
|
|
|
|
|
228
|
|
|
90
|
|
|
|
|
2577
|
|
4
|
90
|
|
|
90
|
|
454
|
use warnings; |
|
90
|
|
|
|
|
180
|
|
|
90
|
|
|
|
|
4240
|
|
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
|
|
545
|
use base qw(Net::DNS::Resolver::Base); |
|
90
|
|
|
|
|
190
|
|
|
90
|
|
|
|
|
51977
|
|
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
|
|
38
|
my $defaults = shift->_defaults; |
34
|
|
|
|
|
|
|
|
35
|
8
|
|
|
|
|
68
|
$defaults->_read_config_file($_) foreach @config_file; |
36
|
|
|
|
|
|
|
|
37
|
8
|
|
|
|
|
90
|
%$defaults = Net::DNS::Resolver::Base::_untaint(%$defaults); |
38
|
|
|
|
|
|
|
|
39
|
8
|
|
|
|
|
118
|
$defaults->_read_config_file($_) foreach @dotfile; |
40
|
|
|
|
|
|
|
|
41
|
8
|
|
|
|
|
85
|
$defaults->_read_env; |
42
|
8
|
|
|
|
|
18
|
return; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
__END__ |