|
|
| The stupid question is the question not asked | |
| PerlMonks |
Getting the FQDN using Net::Domainby nickolsen (Initiate) |
| on Jan 25, 2012 at 17:18 UTC ( #949932=perlquestion: print w/ replies, xml ) | 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 ... eliminate(s) calls to gethostbyname, and therefore DNS lookups. ...Why not just ask "gethostbyname" (or, as the man-page [0] recommends: a non-obsolete variant) and leave it to the user to configure their name resolution the best possible way? 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 [1] 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 ;-))? [0]: http://www.kernel.org/doc/man-pages/online/pages/man3/gethostbyaddr.3.html [1]: http://www.kernel.org/doc/man-pages/online/pages/man5/resolv.conf.5.html
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||