Subject: | CGI::Fast not honoring ENV values unless in BEGIN |
According to the POD, CGI::Fast honors the environment variables
FCGI_SOCKET_PATH and FCGI_LISTEN_QUEUE. However, experimentally these
variables only take effect if assigned in a BEGIN block prior to loading
CGI::Fast. Without this, invoking the program causes it to simply run
once and exit. eg.
#!perl
use CGI::Fast;
local $ENV{FCGI_SOCKET_PATH} = ":9000";
local $ENV{FCGI_LISTEN_QUEUE} = 20;
while ($q = CGI::Fast->new) {
print $q->header;
print "<html><body>The foo input is ", $q->param('foo'),
"</body></html>";
}
prints
Content-Type: text/html; charset=ISO-8859-1
<html><body>The foo input is </body></html>
on STDOUT and exits immediately. To fix this you have to change the code
as follows:
BEGIN {
$ENV{FCGI_SOCKET_PATH} = ":9000";
$ENV{FCGI_LISTEN_QUEUE} = 20;
}
use CGI::Fast;
I can't say whether this is a code or POD bug since I'm not sure what
the original intent was, but it's definitely one or the other.