VinsWorldcom has asked for the wisdom of the Perl Monks concerning the following question:
This seems like a basic question, but I can't find what I'm looking for.
I'm looking for a module that does DNS name resolution *easy*. I can write the code to do getaddrinfo() / getnameinfo() and the legacy gethostby...() but that's lots of code I cut/paste into my scripts whenever I need name resolution. To make it worse, there are all sorts of checks for Socket version to accommodate for IPv6 - which I need my scripts to be aware of.
I'm looking for something like:
use Magic::Name::Resolution ... host2addr('www.google.com'); # print 1st IP addr returned, 4 or 6 host2ipv4('www.google.com'); # print 1st IPv4 addr returned host2ipv6('www.google.com'); # print 1st IPv6 addr returned ...
Hopefully you get the picture. All the messy stuff I do in code to resolve those names to addresses is obscured in a module. I thought of putting all my code in a module, but wanted to see what you all use since my CPAN searches for "DNS", "resolve", "host", "getaddr" turn up the usual suspects which require more "low-level" code writing (which again, I do, but I do repeatedly in all my scripts that need it). Looking for a nice simple API like above in a re-usable module instead of my current cut/paste approach.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Name resolution module
by hippo (Bishop) on Oct 03, 2017 at 12:17 UTC | |
by VinsWorldcom (Prior) on Oct 03, 2017 at 13:52 UTC | |
Re: Name resolution module
by 1nickt (Canon) on Oct 03, 2017 at 11:53 UTC | |
by VinsWorldcom (Prior) on Oct 03, 2017 at 13:50 UTC | |
Re: Name resolution module
by holyghost (Beadle) on Oct 04, 2017 at 19:11 UTC |