Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: CGI Error Handling

by giulienk (Curate)
on Dec 10, 2001 at 14:57 UTC ( #130624=note: print w/ replies, xml ) Need Help??


in reply to CGI Error Handling

I don't know your exact needs but i think you should check out CGI::Carp module.

use CGI::Carp qw(fatalsToBrowser); die "Error! $error" if ($error);
This output the error to the browser in a pretty way.

gkinueliileunikg


Comment on Re: CGI Error Handling
Download Code
Re: Re: CGI Error Handling
by davorg (Chancellor) on Dec 10, 2001 at 15:06 UTC

    Whilst this is great to use when you're developing a script, I wouldn't advise using it in production code. This is because the error messages that it gives can be a source of useful information for anyone trying to crack your site. In some cases, just knowing that you've got Perl installed on you server can give crackers a head start.

    Error messages like this belong in the server error log where the webmaster can read them. There's a good reason why Apache gives a plain 500 error page by default.

    --
    <http://www.dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

      It almost sounds like you're warning people away from using CGI::Carp entirely. (You probably aren't, but I wanted to post this for the benefit of other readers that might also be confused.) It's mainly the fatalsToBrowser and warningsToBrowser bits that we don't want to see in production code. CGI::Carp's primary purpose is to format out nice, debug-friendly error messages in your server's error logs, so I definitely recommend its use even in production code.
Re: Re: CGI Error Handling
by uwevoelker (Pilgrim) on Dec 10, 2001 at 18:19 UTC
    Thanks for the hint, but CGI::Carp is out of the question. I need something that produces an errorpage in the same style as the application ist.
      CGI::Carp can easily be told to use your own template or function for generating the error message to the user. Check out the documentation for specifics.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://130624]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (14)
As of 2014-11-27 11:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (183 votes), past polls