in reply to What is dienice???

As tachyon says, the "dienice" function is a function which makes your errors look prettier than the standard "internal error" page. They have become popular largely thru their use in a number of beginners' CGI books.

However, there's one important point to note with a "dienice" routine. tachyon's version does the right thing by simply displaying a vague error message to the user, but many versions from books display the complete error message to the user. This is generally a bad idea. Giving actual Perl error messages to users should be avoided. It will probably confuse your users and it gives too much information to the black-hats.

The generic "internal server error" page is the way it is for a very good reason. It gives the user all the information that is necessary. The important thing is to write the real error message into the web server error log where it belongs so the webmaster can see it.

For this reason, I very rarely use a "dienice" function, prefering to write a custom 500 error page which mirrors the look and feel of the web site.

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

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

Replies are listed 'Best First'.
Re^2: What is dienice???
by tachyon (Chancellor) on Aug 19, 2004 at 11:23 UTC

    Just to add to the custom 500 page theme.....

    # in httpd.conf you need some lines like: ErrorDocument 404 /custom_error/error_404_not_found.htm [snip] ErrorDocument 500 /custom_error/error_500_internal_server_error.htm # then you need a custom doc where you specified it above, the guts of + our 500 is ..... <div id="contentstart"> <h3>500 Internal Server Error</h3> <p><img border="0" src="/images/thumbs_down.gif" width="14" height="17 +"> Sorry a 500 Internal Server Error error has occurred.</p> <p>The server encountered an unexpected condition which prevented it f +rom fulfilling the request. This is probably due to routine maintenance. Then again w +e may have to sack the programming team! This error has been logged and we will look + into it, if it persists.</p> <p>Sorry you have experienced a problem.</p> <p>Click <a href="/index.htm">here</a> to return to our entry page, or + <a href="/index/contact.htm">here</a> to contact us about the issue.</ +p> <p><i>Kind Regards</i></p> <p><i>The BlahBlah team</i> </p><hr width="100%"><i>Apache 1.3.29 Server at blah.org Port 80</i> </div>

    cheers

    tachyon

      Sort of a pedant's note. Click 'here' links are pretty awful. Aside from all the usual gripes (bad indexing by search engines, &.c), which are largely useless in the case of an error page, it reduces the usability for visitors with disabilities.

      It's very hard for, say, a visually-impaired person to have their assistance software try to distinguish between 'here' and 'here'. A better section would be:

      <!-- snippet --> <p>Sorry you have experienced a problem.</p> <p>You may wish to visit <a href="/index.htm">our entry page</a>; or, <a href="/index/contact.htm">contact us</a> about the issue.</p> <p><i>Kind Regards</i></p> <!-- end snippet -->

        Good point, but of course our 500 page never sees the light of day ;-)

        cheers

        tachyon