[cgiapp] Best practice for dealing with errors during the cgiapp_init method

Gabor Szabo szabgab at gmail.com
Mon Jan 21 21:09:52 EST 2008


As I understand the error_mode should be defined in the setup() phase.
What is the standard way to handle errors during the previous phases,
e.g. during cgiapp_init()?
What if the configuration file read during cgiapp_init is missing or
if the database connection could
not be established?

Right now I have this in my script:

eval {
    $dn = WebApp->new;
    $dn->run;
};
if ($@) {
    warn "Major crisis: $@";
    print "Content-type: text/html\n\n";
    print "Major crisis. Please ask the site administrator to look at
the log files.\n";
}


Any better way to handle this?

Gabor


More information about the cgiapp mailing list