[cgiapp] Graceful Error Handling in CGI::App (compile / init stages)

Mike Tonks fluffymike at googlemail.com
Wed Jul 7 05:16:27 EDT 2010


Hi All,

I've just had the pleasure of a couple of colleagues trying to install
our CGI::Application based project, and realised I could improve the
basic error messages displayed to the user at this stage.

Common errors are:

1) So and so CPAN module is not found

2) Config file not found (ConfigAuto - in cgiapp_init)

currently these produce an ugly 500 Server Error and loeave you
searching in the apache log for the problem.

For 1) is there a better way than:

use Data::Dumper;
use XML::Simple;
use Date::Manip;
use HTML::FromText;
etc

that will safely try to load the modules needed and allow me to report
via a nice formatted error page what's wrong?

2) If I hit an error in cgiapp_init, is there a way to redirect to an
error page, as per prerun_mode() ?

Regards,

mike


More information about the cgiapp mailing list