Subject: | local hostname calculation problem |
I am running a CGI script on Windows XP with Apache 2. As a result, this line:
my $local_name = $ENV{HOSTNAME} || $ENV{HTTP_HOST} || (gethostbyname 'localhost')[0];
is using $ENV{HTTP_HOST} for $local_name which in my case is "localhost:8888." The problem then is that the following line:
my $local_IP = join('.',unpack('CCCC',(gethostbyname $local_name)[4]));
takes about 2 1/2 seconds to fail looking up that hostname. I'm not sure what the resolution is - strip port information from $ENV{HTTP_HOST} if it is being used perhaps?
Thanks for a great module,
Mike