We have an existing Perl application that supports mod_perl
. However, our new host (Dreamhost) does not suppport mod_perl, only FastCGI; thus necessitating the port.
The existing code does not use any Apache specific stuff and is just normal Perl code written in way that's acceptable to mod_perl
.
Reading the documentation and online tutorials, it appears that adding FastCGI support involves wrapping existing code inside a specific kind of loop. Below are the most commonly given skeleton code:
A. Using FCGI
use FCGI;
while (FCGI::accept >= 0)
{
#Run existing code.
}
B. Using CGI::Fast
use CGI::Fast
while (my $cgi = CGI::Fast->new())
{
#Run existing code.
}
Sub-Questions:
- Are methods A and B equivalent ways to add FastCGI support?
- If A and B are different, what then are the pros and cons of using one over the other?
- Are there any best practices or gotchas one should know about when porting from
mod_perl
to FastCGI?
Thanks.