On 4/10/07, Jen mlists <[EMAIL PROTECTED]> wrote:

How to judge whether I've output the http header or not where in cgi
scripts?Thank you.

I think you're asking how a programmer can know whether or not the
header has already been output when it's time to produce output (in an
error-handling subroutine, say). Perhaps you want to use a global flag
in your program; that's a simple solution. Or your error handler could
simply output the header in any case, since it's an error message
anyway.

My preferred solution is to use an eval block that returns (rather
than outputting) a complete web page. If everything worked, it's
simple to output the page; otherwise, it's equally simple to output an
error page. In either case, there's no worry about the headers until
output time.

Is that what you needed?

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to