|Perl: the Markov chain saw|
Getting the FQDN using Net::Domainby nickolsen (Initiate)
|on Jan 25, 2012 at 17:18 UTC||Need Help??|
nickolsen has asked for the
wisdom of the Perl Monks concerning the following question:
Dear fellow monks,
I have a question regarding the Net::Domain-Module:
The sub _hostdomain() tries to look up the hostdomain by searching for the strings "domain" or "search" in /etc/resolv.conf, if the domainname is not already defined or returned by
The comment says, that trying to look up the domainname in /etc/resolv.conf is done to
But back to the module:
If I get it correctly the module prefers the first entry of the last line starting with "domain" or "search".
Say we have a resolv.conf looking like this:
the module would say, that the hostdomain is "internal.example.org" though the real hostdomain was e.g. "example.org".
The resolv.conf (5) manpage  states:
...So if I see that correctly, relying on an entry in the "search" block is a bit risky, isn't it?
Thank you for reading all this and I'd be very happy if someone could give me a hint, why the module behaves this way (or corrects me if I got anything wrong ;-))?