in reply to Re^4: How a web server sending data to a CGI perl script ?
in thread How a web server sending data to a CGI perl script ?

I read the RFC recommended,I know what I should prepare (and I already knew) for my script, but the question is how to send it to the script.

client makes a request through socket , your server reads headers, then

Populate a local %ENV

dispatches/calls/invokes a process ,

through pipe, fork, whatever, see perlipc, Capture::Tiny

put http request BODY on STDIN

Collect output from STDOUT

log errors from STDERR

After timeout, or whatever, return/generate/forward a return HTTP request back on socket to the client

I already linked examples in Re: How a web server sending data to a CGI perl script ?

  • Comment on Re^5: How a web server sending data to a CGI perl script ?

Replies are listed 'Best First'.
Re^6: How a web server sending data to a CGI perl script ?
by exilepanda (Friar) on Jan 22, 2016 at 03:47 UTC
    Thanks and I am still reading.... I can feel something and it's insightful indeed. Would be glad to hear more from your advise though :

    1. Do you think rather send out the data to an external script, import the external code into the server and run it is a better approach (eg. require "script.pl") ?

    2. Can you tell if when a web server claims it supports a certain language, it does have to implement something ( not just command line ) to prepare the environment ( meta ) variables for that particular language ?

      1. Do you think rather send out the data to an external script, import the external code into the server and run it is a better approach (eg. require "script.pl") ?

      Sure its a better approach (hint CGI::Compile/ ), for perl, its called PSGI as implemented by Plack

      2. Can you tell if when a web server claims it supports a certain language, it does have to implement something ( not just command line ) to prepare the environment ( meta ) variables for that particular language ?

      What "web server" are claiming what kind of support?

      Yeah, question is kinda vague, claimed support can be anything, from what mod_perl does (full control) to what to merely support for better-than-CGI like WSGI, PSGI, Rack, JSGI, SCGI...

        Hmm... think that I got the starting point now. The interface of CGI::Compile looks good to me. Thanks again! and much appreciated for all your help! =)