FastCGI Perl?

software development


I’m trying to use FastCGI to cut down on the CPU my website burns. So to test it, I installed mod_fastcgi on my box at home and it works like a charm:

Hello World in Perl
Fast? 1

So I copied my fasttest.fpl script over to dreamhost and enabled fast CGI through the domain manager. On my website at dreamhost, the same script says:

Hello World in Perl
Fast? 0

Uh. Ok. It runs, but it isn’t running as a FastCGI.

So I asked support and they said “We checked, your site is configured for FastCGI. It’ll just work if you write your script correctly.”

Gee. Thanks. That helps a lot.

Here’s my testing script:


use lib ‘/home/ndw/usrperl/local/lib/perl/5.8.4’;
use FCGI;

my $request = FCGI::Request();

while($request->Accept() >= 0) {
print “Content-Type: text/plain”, “\n\n” ;
print “Hello World in Perl”, “\n”;
print "Fast? ", $request->IsFastCGI(), “\n”;

The ‘use lib’ bit is to load FCGI from where I installed it locally. That part works because the script aborts if it can’t load the module.

Can anyone see what’s wrong, or does anyone have a working FastCGI perl script that they can share?