1package Net::DNS::Resolver::UNIX;
2#
3# $Id: UNIX.pm 482 2005-09-02 13:34:33Z olaf $
4#
5
6use strict;
7use vars qw(@ISA $VERSION);
8
9use Net::DNS::Resolver::Base ();
10
11@ISA     = qw(Net::DNS::Resolver::Base);
12$VERSION = (qw$LastChangedRevision: 482 $)[1];
13
14my $resolv_conf = '/etc/resolv.conf';
15my $dotfile     = '.resolv.conf';
16
17my @config_path;
18push(@config_path, $ENV{'HOME'}) if exists $ENV{'HOME'};
19push(@config_path, '.');
20
21sub init {
22	my ($class) = @_;
23
24	$class->read_config_file($resolv_conf) if -f $resolv_conf && -r _;
25
26	foreach my $dir (@config_path) {
27		my $file = "$dir/$dotfile";
28		$class->read_config_file($file) if -f $file && -r _ && -o _;
29	}
30
31	$class->read_env;
32
33	my $defaults = $class->defaults;
34
35	if (!$defaults->{'domain'} && @{$defaults->{'searchlist'}}) {
36		$defaults->{'domain'} = $defaults->{'searchlist'}[0];
37	} elsif (!@{$defaults->{'searchlist'}} && $defaults->{'domain'}) {
38		$defaults->{'searchlist'} = [ $defaults->{'domain'} ];
39	}
40}
41
421;
43__END__
44
45
46=head1 NAME
47
48Net::DNS::Resolver::UNIX - UNIX Resolver Class
49
50=head1 SYNOPSIS
51
52 use Net::DNS::Resolver;
53
54=head1 DESCRIPTION
55
56This class implements the UNIX specific portions of C<Net::DNS::Resolver>.
57
58No user serviceable parts inside, see L<Net::DNS::Resolver|Net::DNS::Resolver>
59for all your resolving needs.
60
61=head1 COPYRIGHT
62
63Copyright (c) 1997-2002 Michael Fuhr.
64
65Portions Copyright (c) 2002-2004 Chris Reinhardt.
66
67All rights reserved.  This program is free software; you may redistribute
68it and/or modify it under the same terms as Perl itself.
69
70=head1 SEE ALSO
71
72L<perl(1)>, L<Net::DNS>, L<Net::DNS::Resolver>
73
74=cut
75