Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks,

How can I avoid the die in CGI::Carp (fatalToBrowser) print the "Content-type: text/html\n\n" ?

*the set_die_handler is not working :(

Replies are listed 'Best First'.
Re: Die nicely
by Anonymous Monk on Apr 02, 2008 at 09:51 UTC
    If you use set_die_handler(), you will most likely interfere with the behavior of fatalsToBrowser, so you must use this or that, not both.
Re: Die nicely
by CountZero (Bishop) on Apr 02, 2008 at 12:23 UTC
    CGI::Carp (fatalsToBrowser) purpose is to send this header, followed by the error message. As your script just died, most probably no header info was yet generated by the server and sending the error message without first giving a header to the server will cause a "500 Internal Server Error".

    So the question now is: why do you want to avoid this header information being generated?

    Update: fixed typo

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James