in reply to DIE or Fatals cause Redirect?

For errors that occur after you've already spit out the header, you can write a custom handling routine (e.g. use or bail_gracefully($!) instead of die, and have bail_gracefully do whatever needs doin' with $!.)

Most HTTP servers have a facility for generating custom error pages -- you can even set up a CGI to handle them. So read up on your webserver's documentation. Under Apache, it can be as simple as adding the line

ErrorDocument 500 /cgi-bin/error_handler.pl

Which says "if there is an error with code 500 (caused by a program's failing to execute, or to output proper headers), redirect the user to this URI."

HTH

perl -e 'print "How sweet does a rose smell? "; chomp ($n = <STDIN>); +$rose = "smells sweet to degree $n"; *other_name = *rose; print "$oth +er_name\n"'

Replies are listed 'Best First'.
(ichimunki) re x 2: DIE or Fatals cause Redirect?
by ichimunki (Priest) on Jul 19, 2001 at 23:00 UTC
    One note on the ErrorDocument 500 method: make sure if you use a .pl script for this rather than a static .html file that the script is guaranteed to execute flawlessly, or you get into a potentially nasty situation.