Hi,

In my web application, I am using Apache server with mod_perl.  In one of my
Perl modules, I am creating a client socket using IO::Socket::INET which is
accepting the hotsname and port values from the environment variables set in
the Apache config file http.conf.  For some reason, this didn't work
eventhough I have verified that the values were set and retrieved correctly.
Below is the extract of my codes:

In the config file http.conf:

        PerlSetEnv AGENT_SOCKET_HOST  'gaia'
        PerlSetEnv AGENT_SOCKET_PORT  4444

In my AgentSocket.pm:

        use strict;
        use IO::Socket::INET;
        sub new
        {
                $host = $ENV{AGENT_SOCKET_HOST};   # I have checked these values are 
same
as
                $port = $ENV{AGENT_SOCKET_PORT};   # those set in the http.conf

                $socket = new IO::Socket::INET(
                                                        PeerAddr => $host,
                                                        PeerPort => $port,
                                                        Proto    => 'tcp')
                or die "Cannot connect to $port at $host";
                        :
                return $socket;

        }

The above socket did not get connect to the server but didn't die either.
But if I assigned
 $host='gaia', $port='4444' within the AgentSocket.pm then it worked fine.

I have been tearing my hair out for days now and can't find the answer.
Perhaps you could help.  Thanks in advance.

Regards,
Dean

Reply via email to