in reply to Re: perl -COE and, for example, CGI::Application
in thread perl -COE and, for example, CGI::Application
and in App.pm:#!/usr/bin/perl use CGI::Fast(); use App; use utf8; # fastcgi usage as told in: http://cgiapp.erlbaum.net/index.cgi?FastCG +I while( my $q = new CGI::Fast ){ $q->header(-charset => 'utf-8'); # as I now set :utf8 in cgiap +p_prerun, might be more beautiful to also move this there.. my $app = new App( QUERY => $q ); $app->run(); }
Actually, the above code isn't exactly my code, as I think I found a bug in the logic while writing this (I've already corrected the above based on this).use base 'CGI::Application'; ... sub cgiapp_init { ## under FCGI CGI::Application permanently re-inits itself. No +t 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(); ... } ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: perl -COE and, for example, CGI::Application
by karavelov (Monk) on Sep 23, 2008 at 15:18 UTC |