I'm trying to execute a simple perl cgi script in Apache Tomcat Server with CGI Servlet.
My perl cgi script:
print "Content-Type: text/html\n\n";
my $url = 'http://127.0.0.1:8080/cgi-bin/test.pl';
my $content = "name=jagadish";
my $headers = new HTTP::Headers(Content_Type => "text/html",
Content_Length => length($content));
my $request = new HTTP::Request('POST' => $url, $headers, $content);
my $ua = new LWP::UserAgent;
my $response = $ua->request($request);
print $response->as_string, "\n";
When I try to call this script in the browser, all I get is the below error in the browser window,
500 Can't connect to 127.0.0.1:8080 (Unknown error) Content-Type: text/plain Client-Date: Wed, 24 Nov 2010 17:53:56 GMT Client-Warning: Internal response 500 Can't connect to 127.0.0.1:8080 (Unknown error)
If I execute the above script from the command like (just like any other stand alone perl script), it just works fine.
The problem occurs only when the script is executed by the apache server. I don't what I'm doing wrong here.
My System Configuration:
Windows Server 2003
Apache Tomcat Server with CGI Servlet Enabled
Any help would be appreciated...
Let me know, if you need more information