You're always going to be emitting Content-type: text/html so do so at the top of the script. Scattering "have I done this yet" logic throughout the script makes for a needless mess. A good place is right after you unbuffer stdout by doing $|++; Now, when you've got a failure in one particular case, comment the bulk of that case out, substituting print "Test\n"; or whatever. Then gradually comment less and less of the code for that case out until you find out what's causing the breakage.
This is a variant of another standard piece of debugging advice: Find the smallest fragment of code that demonstrates the problem. Often this exercise is sufficient to help you locate the problem. Doing this is a good habit to adopt.
In reply to Re: anyone have an answer?
by dws
in thread CGI hanging during HTML generation (was : anyone have an answer?)
by emilford
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |