Wally Hartshorn has asked for the wisdom of the Perl Monks concerning the following question:
I'm stumped and am looking for some ideas.
I have a program that will (via a web form) accept a file containing comma-separated values, store that file somewhere, then re-open the file, processing each line and inserting the data as rows in a MySQL database.
When I run my unit tests from the command line, everything appears to work perfectly. When I actually use a web browser to run the program via CGI, the program works fine except that it doesn't process the last few rows of the uploaded file. It appears to not read them at all!
I would think that there is a problem with the upload, except that the program accepts the uploaded file, stores it, then opens and processes the stored file. Because the file remains on the disk after processing, I can have my unit tests use the previously stored file and the file will be processed perfectly.
Obviously there is something different about running the program from the command line as opposed to running it via CGI.
My first thought was that, since the CGI version would run as user "nobody", it would therefore would have a different environment. However, when I su'd to be nobody and ran the unit tests, they worked fine.
Does anyone have any suggestions on other ways in which the command-line environment would differ from the CGI environment in such a way as to cause this behavior? Or suggestions on ways to find the cause? (The code is lengthy, so I'm not sure that showing it would really be that helpful.)
Wally "Mystified" Hartshorn
(Plug: Visit JavaJunkies, PerlMonks for Java)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Differing Behavior as CGI vs. Command Line
by Zaxo (Archbishop) on Jun 13, 2003 at 21:57 UTC | |
|
Re: Differing Behavior as CGI vs. Command Line
by svsingh (Priest) on Jun 13, 2003 at 23:48 UTC | |
|
Re: Differing Behavior as CGI vs. Command Line
by freddo411 (Chaplain) on Jun 14, 2003 at 00:13 UTC | |
|
Re: Differing Behavior as CGI vs. Command Line
by waswas-fng (Curate) on Jun 13, 2003 at 21:51 UTC | |
by Wally Hartshorn (Hermit) on Jun 13, 2003 at 21:56 UTC |