have you tried running it from command line with debug? for this you can either read the CGI doc on how to do it OR just temporarily mod the program and hardcode a filename in for processing. I assume the typical suspects (file permissions) are all ok for the CGI running in the webserver environment can write files to the directory?
the hardest line to type correctly is: stty erase ^H