#!/usr/bin/perl use CGI::Fast(); use App; use utf8; # fastcgi usage as told in: http://cgiapp.erlbaum.net/index.cgi?FastCGI while( my $q = new CGI::Fast ){ $q->header(-charset => 'utf-8'); # as I now set :utf8 in cgiapp_prerun, might be more beautiful to also move this there.. my $app = new App( QUERY => $q ); $app->run(); } #### 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(); ... } ...