Ya just gotta love cpan.NAME Sys::HostIP - Try really hard to get IP addr. SYNOPSIS use Sys::HostIP; $ipaddr= hostip; # get (text) dotted-decimal ip use IO::Socket; use Sys::Hostname; # Have to try non-cannonical name first, since there # is a better chance the computer knows itself than # of DNS knowing it. if($^O eq 'MSWin32') # check ipconfig.exe # (Which does all the work of checking the registry, # probably more efficiently than I could.) # check nbtstat.exe # (Which does all the work of checking WINS, # more easily than Win32::AdminMisc::GetHostAddress().) # check /etc/hosts entries # check /etc/lmhosts entries # (It will only be here if the file has been modified since th +e # last WINS refresh, which is unlikely, but might as well try. +) elsif($^O=~ /IX|ux/i) # check /etc/hosts entries # last resort: ping (which can be very slow)
In reply to Re: Finding your IP address with Perl (Sys::HostIP)
by ybiC
in thread Finding your IP address with Perl
by $ENV{REMOTE_USER}
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |