in reply to Finding your IP address with Perl
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)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Finding your IP address with Perl (Sys::HostIP)
by $ENV{REMOTE_USER} (Novice) on Dec 04, 2000 at 22:48 UTC | |
by ybiC (Prior) on Dec 04, 2000 at 23:08 UTC | |
by $ENV{REMOTE_USER} (Novice) on Dec 05, 2000 at 09:00 UTC | |
|
Re: Re: Finding your IP address with Perl (Sys::HostIP)
by $ENV{REMOTE_USER} (Novice) on Dec 04, 2000 at 21:57 UTC |