use base 'CGI::Application'; ... sub cgiapp_init { ## under FCGI CGI::Application permanently re-inits itself. Not what you would expect from cgiapp_init and setup, anyway... ## so we do a hack to get this here executed only once. setup() can be executet over and over if(!$self->{remember_app_init_done}){ # do one time setup stuff here } ## declare init done $self->{remember_app_init_done}=1; } sub setup { ... ## prepare runmodes $self->start_mode('default'); # $self->error_mode('error'); $self->run_modes(); ... } ...