in reply to perl -COE and, for example, CGI::Application
What I usually use for output encoding is just:
binmode STDOUT, ':utf8';If you run in under FastCGI, put this line in cgiapp_prerun. In the mode where you output the binary data insert
binmode STDOUT,':raw';If you expect unicode data from forms, you could put this code in your cgiapp_prerun stage:
my $vars = $self->query->Vars; while ( my($k,$v) = each %$vars ){ next unless defined $v; next if $self->query->upload($k); # uploads are binary next if $k eq 'auth_password'; # else MD5 crashes; $self->query->param( -name=>$k, -value=>Encode::decode_utf8($v) ); }
Using applications written with CGI::Application under FastCGI is a little bit troublesome. The recommended in the documentation method of programatically switching runmodes with "prerun_mode" leaves the object further unusable. So the the plugins that use this method (Forward, Redirect, Session, Authentication, Authorization) I find them unusable in fast-cgi environment.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: perl -COE and, for example, CGI::Application
by isync (Hermit) on Sep 23, 2008 at 10:29 UTC | |
by karavelov (Monk) on Sep 23, 2008 at 15:18 UTC |