|Pathologically Eclectic Rubbish Lister|
perl/cgi question: script works from unix command line, but not web pageby geoffhanna (Initiate)
|on Apr 03, 2002 at 01:18 UTC||Need Help??|
geoffhanna has asked for the wisdom of the Perl Monks concerning the following question:
I read the FAQs, tried several searches, either the info I need isn't here yet or more likely I am not familiar enough with MonkSearching to find it. If this should be posted somewhere else, or there is already a thread that will help me, please let me know.
I am a windows programmer teaching himself perl/cgi using some unix server or another supplied by my ISP that appears to run Apache. The stupidity inherent in that last sentence is only a warning of the vast ignorance yet to come...
The goal of this script is to read a data file that consists of name=value pairs and compare it to the name=value pairs coming in (as stdin) from my entry web page. When a name from the web page matches a name from the data file and there is a value attached to the name, overwrite the data file value with the web page value. Once all name=value pairs have been inspected, write the modified data file back to current directory, and refresh the entry web page (restoring all the form controls to blank).
Invoking the script from the unix command line works perfectly, data file is modified and re-written, the other script referenced at the end of the main script is executed, eveyone is happy.
Invoking the script as a form submit action from the web page yields different results. The data comparison does occur - as evidenced by the "print" output at the end of the script which shows the modified data file - but nothing writes back to the data file. Also, the "system" call doesn't actually do anything (nor did the "exec" call I had there originally).
Is there a limit of one output device per CGI script or something? It sounds stupid to even type that question but I can't think of another reason. If I comment out the web page refresh code, then the data file works properly - although the exec calls still do not work.
Here is the script that has been killing me for two days:
Edit kudra, 2002-04-19 Changed title