[cgiapp] Getting error_mode to catch die in cgiapp_prerun

Jaldhar H. Vyas jaldhar at braincells.com
Fri Jan 16 14:09:45 EST 2009


On Fri, 16 Jan 2009, Lyle wrote:

> Hi All,
> I've noticed that if my app dies in cgiapp_prerun then my error mode defined 
> in setup isn't called.
>
> Is there a reason for this? Is there a way to get error_mode to catch errors 
> in cgiapp_prerun?
>
>

This is an architectural limitation of CGI::Application.  see the code for 
run() and __get_body() in the source.

A workaround is to wrap your prerun in an eval and call 
$self->error_mode($@) and possibly $self->call_hook('error', $@) yourself 
if it dies.

-- 
Jaldhar H. Vyas <jaldhar at braincells.com>


More information about the cgiapp mailing list