I've achieved several partial successes, but can't cross the last hurdle.
Symptom: When in test mode FastCGI performs perfectly. When running plain perl scripts in eval or do mode it performs perfectly. As soon as I attempt to access the FCGI::Request() object or the CGI::Fast->new object, it hangs indefinitely. Here's my config:
[Types]
fcgi=FCGI
cgi=FCGI
pl=FCGI
pm=FCGI
[FCGI]
ExePath=C:\perl\bin\perl.exe
;ExePath=C:\strawberry\perl\bin\perl.exe
Arguments="-MFCGI::IIS=eval"
;Arguments=d:\inetpub\cgi-bin\hello.fcgi
;Arguments=d:\inetpub\cgi-bin\h2.fcgi
ActivityTimeout=5
QueueLength=999
MaxInstances=20
InstanceMaxRequests=500
You can see the things I've tried referenced above with ;'s. Using ActiveState or Strawberry results in the same behavior. If I set the -MFCGI::IIS argument equal to "test", it runs the tests perfectly. Eval, do, and no setting all hang indefinitely.
Most tellingly, if I set the Arguments = to a valid FCGI file (or .pl/.cgi/.pm) then that single script will run perfectly. The perl instance persists across calls precisely as it should, and it runs with advertised speed. The calls to the FCGI::Request() or CGI::Fast->new methods all return the objects they should. Everything is positively hunky dory, but that's not the correct config. I have a raft of cgi files, and I'd have to create a separate mapping entry for each cgi file to make that ugly kludge work.
I suspect I'm missing a setting that causes the name of the script to be sent as an argument to perl, but I can't see the param. Thanks for any help.
Edit: My suspicion is incorrect. FCGI is definitely calling the correct scripts, but it's calling them with the wrong environment somehow. If I use the -MFCGI::IIS argument, I call exactly the same script as if I use the explicit path argument, but when I use the explicit path argument the scripts can find their libraries. My challenge is to get the scripts to identify their libraries correctly.
When using -MFCGI::IIS this script fails:
#!c:/perl/bin/perl
use CGI::Fast;
The error is:
Error!
Can't locate object method "FILENO" via package "FCGI::Stream" at
C:/Perl/lib/CGI.pm line 822.
Compilation failed in require at C:/Perl/lib/CGI/Fast.pm line 20.
BEGIN failed--compilation aborted at C:/Perl/lib/CGI/Fast.pm line 20.
Compilation failed in require at (eval 4) line 4.
BEGIN failed--compilation aborted at (eval 4) line 4.
When using an explicit script reference, this script succeeds completely. It maintains the same perl PID, maintains its count, and returns accurate values. Mostly, though, it can import its modules.
#!c:/perl/bin/perl -w
use strict;
use CGI::Fast;
my $count = 1;
while (my $q = CGI::Fast->new)
{
print("Content-Type: text/plain\n\n");
print("Process ID: $$; Count is: " . ++$count);
}
There has just got to be some ENV var I can set to make perl able to find its modules.