J
John Bokma
Abby said:Hi,
I have no experience in Perl, but I need to write a Perl script.
What the script will do is .. it will pass some arguments, which I got
from text box in the form on webpage, to my c program (.exe file) as
arguments, run the program, then display the command-line output to
the web browser. Could anyone please give me an idea how to start,
please?
CGI.pm (getting parameters, creating headers).
-T option in the she-bang
-w option in the she-bang
use strict;
read on "system"
If you generate HTML using CGI.pm notice that recent versions default to
XHTML. Understand the impacts of this.
understand all the dangers of passing parameters from a form to an
executable.
What I recommend if:
a given parameter can only be a number between 1 and 100 *check* this.
Check it is a number *and* check if it falls in the range. Never ever
assume that your form gets valid values *nor* ever assume that client
side checks (JavaScript, maxlength etc) succeed (zie link in my sig).
If a parameter value falls out of a range, is not what you expect then
give an error. This is an exception. Something is *wrong*. Don't ever
try to fix it or fall back to defaults. If you get a silly value shout,
yell, complain. Don't silently fix & accept.
Be very very careful what you allow to be passed via a web form. All
your enemies are out there and able to call your script in every
possible bad way. Don't trust anything, ever. Even not the headers you
get (for example referer). Assume the worst.