A long time ago, i posted this regarding what to do when bugs are found in long lost CPAN modules. I recieved lots of useful information, but unfortunately i never heard back from the author. The patch i wrote is now being used internally at my work with great success.
6 weeks later, i've run into the same problem with Sys::HostIP. I needed a good, portable way to obtain the ip addresses used on a given machine. Sys::HostIP does this well in a Win32 environment, but when used in the *NIX realm, bugs rear their ugly head:
- Most stuff we do in my company has to be written to work without dns. Sys::HostIP depends on dns in *NIX based systems.
- Some people break their /etc/resolv.conf by listing their primary hostname as an alias for 127.0.0.1. Sys::HostIP would erroneously return this ip address.
- There's nothing stopping me from setting my hostname to www.microsoft.com. <cpan::Sys::HostIP> would return 126.96.36.199 in this circumstance, even though that ip address doesn't exist on my system.
- If I use a dial-up connection, and my ip address is set by my isp, that ip would not match up to whatever hostname i gave myself.
So because of this, I've written a module (tenatively named Sys::IP) which contains 3 functions:
- One function returns a scalar containing the first ip address it finds that's not 127.0.0.1. This is convienient for people who only use one interface and don't want to deal with an array or hash.
- One function returns a list of all ip addresses used on a machine.
- One function returns a hash reference to a hash with keys made up of all running interfaces on a machine, and whose values are the interface's ip addresses.
Currently this module works under linux, (Free||open)BSD, Irix, and Solaris. I haven't found any more machines to test this on, but I plan on adding as many OS's as possible. I'll be posting the code here within a few days (gotta write those comments).So here's the question:
- Is it OK to take the Win32 code from Sys::HostIP to use in my module? The module itself states no license terms, and I haven't been able to get in contact with the author (his/her given email address bounces). Which leads me to
- Should this be a seperate module from Sys::HostIP, or a patch for it? Since I can't get in touch with the author, what should i do?
: This post may contain inaccurate information, be habit forming, cause atomic warfare between peaceful countries, speed up male pattern baldness, interfere with your cable reception, exile you from certain third world countries, ruin your marriage, and generally spoil your day. No batteries included, no strings attached, your mileage may vary.