I’m trying to figure out a way to get the mailhost using the ‘resolv’
library, but I’m having trouble because it isn’t documented. What’s a
good analogue of this Perl script?
use strict;
use Net::DNS;
my $resolv = Net::DNS::Resolver->new();
my $packet = $resolv->search(“mailhost”);
foreach my $rr ($packet->answer){
$rr->print;
}
Prints the following (IP addresses changed to protect the guilty):
I’d really just like the first name of the first answer, i.e.
“mailhost.foo.com”.
It seems that I needed to put an explicit domain entry for foo.com in my
/etc/resolv.conf file. Once I did that, then
Resolv.getaddress(“mailhost”) worked.
However, I’m confused as to why “host mailhost” and the Perl code above
worked without it, while the Ruby code required it. Any insight
appreciated.
Regards,
Dan
PS - Solaris 10, btw.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org