in reply to When Does FatalsToBrowser Not Send Fatals To Browser?

CGI::Carp's fatalsToBrowsers catches die. So it won't catch things that don't die nor things that die before it gets control (I think newer versions also catch warn and perhaps some other things, check the documentation source code for your version of the module for more details -- at least the documentation I noticed was quite vague).

The second case is the easiest to categorize. If you have the statement use CGI::Carp 'fatalsToBrowser'; in your script, then CGI::Carp gets control as soon as that statement is done compiling. So compile-time errors in that statement or prior to it will not be caught. For example, #!/usr/bin/perl -wT might cause a "too late for -T" error that would not be caught. Not having CGI::Carp properly installed could also cause problems.

There are a few ways to cause a server error without dieing so that they won't be caught. The following are some likely examples. Whether they actually cause a server error in spite of fatalsToBrowser may depend on the version of CGI::Carp you are using and on your web server configuration:

What can go wrong before Perl gets control depends on your web server configuration. You could have a bad #! line (including having \r\n on the end when just \n was expected).

(updated)

                - tye

Replies are listed 'Best First'.
Re^2: When Does fatalsToBrowser Not Send Fatals To Browser?
by Aristotle (Chancellor) on Jan 15, 2003 at 00:58 UTC
    For completeness: to see warnings, import warningsToBrowser. They will not be printed by default though - call warningsToBrowser(1); to enable and warningsToBrowser(0); to disable printing them. Output comes in the form of HTML comments. Note that warnings raised during disabled output don't get lost - they accumulate and get dumped the next time you enable output. I usually just put a warningsToBrowser(1); at the end of my script so that I get all the warnings in a neat pile at the bottom of my CGI generated page.

    Makeshifts last the longest.