in reply to Getting HTTP POST without webserver??

I guess the author assumes having this running within a webserver...

Yes. A web server passes what are called "environment variables" to perl scripts using a gateway called 'cgi'. The perl script can then access a global hash that is populated with the form data. The server has to be setup so that it recognizes when it is supposed to pass information to a perl script.

You can transfer data directly from one program to another program using sockets, which is not exactly an easy subject to learn, but a js script cannot open up a socket. So it is more than likely that you are very confused about what you want to do--or you are trying to do something that is specifically prohibited by js scripts for security reasons.

The article you read is trying to show how a perl script can get form information from a web server without using the assistance of any perl modules, like CGI.pm. In contrast, the CGI.pm module saves you from having to parse the information by hand. The CGI.pm module does the parsing for you and puts the form information in a global hash, where the keys are the names of the form input elements, and the values are what the user entered in those input elements. You can parse the data yourself or use the CGI module to parse the data for you--but in both cases a web server has to process the form data first, then pass it to the perl script.

  • Comment on Re: Getting HTTP POST without webserver??