in reply to Die function misfunctions
Before anything can be sent to the browser you first have to tell it what kind of data to expect. The "kind of data" (called the "MIME" type) is sent when you send the "Content-type" header, as in
If a proper "Content-type" string isn't the first thing your browser gets from your CGI you'll see a "error 500" just like you did. "Die" doesn't send a "Content-type" header when it sends it's error message, so voila, there's your problem.print "Content-type: text/html\n\n"; # or, same thing but better use CGI qw (:standard); print header;
virtualsue's suggestion to use CGI::Carp qw(fatalsToBrowser); is the solution. This causes any calls to "die" to be redirected to STDOUT, with the proper content-type header, allowing you to automagically see the content of your error message. It's very cool. Use it in good health.
Gary Blackburn
Trained Killer
Correction: Corrected STDOUT to STDERR. Ooops.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Die function misfunctions
by lauragarcia (Acolyte) on Apr 30, 2001 at 20:32 UTC | |
by virtualsue (Vicar) on Apr 30, 2001 at 22:19 UTC | |
by Trimbach (Curate) on Apr 30, 2001 at 21:57 UTC | |
by lauragarcia (Acolyte) on Apr 30, 2001 at 22:35 UTC | |
by isotope (Deacon) on Apr 30, 2001 at 21:41 UTC |