NAME Sys::HostIP - Try extra hard to get ip address related info VERSION version 1.4 SYNOPSIS use Sys::HostIP; #class methods my $ip_address = Sys::HostIP->ip; # $ip_address is a scalar containing a best guess of your host machines # ip address. On unix systems, it will return loopback (127.0.0.1) if it # can't find anything else. This is also exported as a sub (to keep # compatability with older versions). my $ip_addresses = Sys::HostIP->ips; # $ip_addresses is an array ref containing all the ip addresses of your # machine my $interfaces = Sys::HostIP->interfaces; # $interfaces is a hash ref containg all pairs of interfaces/ip addresses # Sys::HostIP could find on your machine. Sys::HostIP->ifconfig("/somewhere/that/ifconfig/lives"); # you can set the location of ifconfig with this class method if the code # doesn't seem to know where your ifconfig lives DESCRIPTION Sys::HostIP does what it can to determine the ip address of your machine. All 3 methods work fine on every system that I've been able to test on. (Irix, OpenBSD, FreeBSD, NetBSD, Solaris, Linux, OSX, Win32, Cygwin). It does this by parsing ifconfig(8) (ipconfig on Win32/Cygwin) output. EXPORT Nothing by default! But, if you ask for it nicely, you'll get: ip(), ips(), interfaces(), and ifconfig(). To export something explicitly, use the syntax: use HostIP qw/ip ips interfaces/; # that will get you those three subroutines, for example HISTORY Originally written by Jonathan Schatz . Currently maintained by Sawyer X . TODO I haven't tested the win32 code with dialup or wireless connections. SEE ALSO * ifconfig(8) * ipconfig AUTHORS Sawyer X Jonathan Schatz COPYRIGHT AND LICENSE This software is copyright (c) 2010 by Sawyer X. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.