Subject: | CGI::Application->psgi_app caches query object (broken) |
If as mentioned in
[href://https://rt.cpan.org/Public/Bug/Display.html?id=72909|Bug #72909 for CGI-Application: persistence issues]
CGI::Application is designed to have a new object created on each request.
then psgi_app, for it to be useful (for runmode to change so its not always the default one),
psgi_app needs to create a new CGI::PSGI object every time
and not cache the old one, like this
sub psgi_app {
my $class = shift;
my $args_to_new = shift;
return sub {
my $env = shift;
require CGI::PSGI;
$args_to_new->{QUERY} = CGI::PSGI->new($env);
my $webapp = $class->new($args_to_new);
return $webapp->run_as_psgi;
}
}
Thanks for listening