Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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:

  • exit(1);
  • kill (perhaps by a watchdog that notes too much memory or CPU usage)
  • printing content that doesn't start with a valid CGI (content-type) header
  • printing something to STDERR

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

In reply to Re: When Does FatalsToBrowser Not Send Fatals To Browser? (not die) by tye
in thread When Does FatalsToBrowser Not Send Fatals To Browser? by Cody Pendant

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-24 03:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found