You might find perl's -c option useful. If you add use strict; and use warnings;, as recommended previously, then check for syntax errors with something like: perl -c script_under_development.cgi, you can find and fix many errors quite easily, without having to look through web server error logs or expose your script to users.
After you have fixed any errors you find with the above method, then you might try running your script from the command line. In the case of your script, it helps to set the environment variable REQUEST_METHOD. If you are doing this on a *nix system, you might try something like:
$ REQUEST_METHOD=POST perl script_under_development.cgi
For me, running your script (as reposted by ww), this gives:
Content-type: text/html <html><head><title>"Thank You Form</title</head><body> Thanks Unknown open() mode 'feedback.cgi' at test.cgi line 14.
This illustrates that not all errors are syntax errors or caught by use strict; or use warnings;. Sometimes you have to run your code and check results.
In this case, you should probably rearrange the arguments to open and I would add its error message to the output from die. Also, as you're not reading from the file, you don't need the + in +>>. Something like the following will probably work better:
open (FL, '>>', 'feedback.cgi') || die ("Hello: feedback.cgi - $!");
You might also think about the security implications of accepting input from the browser and writing it to a file with a .cgi extension in a directory containing CGI programs. If you server is configured securely, the web server process will not have permission to write a file in that directory (IMHO). So, you should probably specify some other path in your open statement, and should probably use an extension other than .cgi.
In reply to Re: my code does not work
by ig
in thread my code does not work
by irvy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |