Appreciate the response.

I looked at CGI.pm and the documentation regarding it. But all the examples I could find using CGI.pm were the case where there was just the need to process one POST/GET request..

In my case I've created a server that needs to process many POST/GET requests. What I am missing is the following loop....

use cgi while (a request to localhost:6789 server) { process the request with CGI.pm modules }
here's the code that makes an attempt at this loop....

use IO::Socket; use Net::hostent; use CGI; # Constants $cnst_port = 6789; # Port we want to listen to $cnst_server = 'http://localhost:' . $cnst_port . '/'; # Server addre +ss $server = IO::Socket::INET->new( Proto => 'tcp', LocalPort => $cnst_po +rt, Listen => SOMAXCONN, Reuse => 1 ); die "Can\'t set up server" unless $server; print STDERR "Server Version 0.637\n" . "Server accepting clients via $cnst_server\n"; while ($client = $server->accept()) { $client->autoflush(1); $cgi = new CGI; $request_path_translated = $cgi->path_translated(); $request_query_string = $cgi->query_string(); $request_request_method = $cgi->request_method(); print STDERR "request_path_translated = $request_path_translated\n"; print STDERR "request_query_string = $request_query_string\n"; print STDERR "request_request_method = $request_request_method\n"; RETURN_DUMMY_PAGE (); close($client); } sub RETURN_DUMMY_PAGE { print $client 'HTTP/1.0 200 OK' . "\n" . 'Content-type: text/html' . "\n\n" . '<HTML>' . "\n" . ' <HEAD><TITLE>Asayo - LED Sign Software XL</TITLE></HEAD>' . "\n" + . ' <BODY><H1>Dummy Page</H1></BODY>' . "\n" . '</HTML>' . "\n"; }
The dummy page gets returned each time, but the CGI calls return nothing..

Any ideas?

In reply to Re^2: Processing POST request in simple Windows server. by John Whitney
in thread Processing POST request in simple Windows server. by John Whitney

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.