Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I reduce Perl CGI script start-up time?

I'm developing some CGI scripts and I'm trying to find a solution to decrease the "starting time" produced when I import a lot of modules with "use".

Update:

The solutions provided are nice, but the scripts I'm working runs both in console and CGI mode checking if some typical HTTP environment variables are present.

In "console mode" they dump the data "normally", and in "html mode" they make some realtime replacements and send other HTTP headers to the client.

I'd like to improve the startup time in both cases.

like image 345
mndg Avatar asked Mar 27 '09 18:03

mndg


1 Answers

Consider using CGI::Fast in order to start one perl process to handle multiple requests. It took me very little effort to change some of my big CGI scripts over to CGI::Fast. Unlike mod_perl, it's very easy to run CGI::Fast on hosting sites because you can restart your scripts without restarting Apache (at least that's what my hoster told me when I asked for mod_perl).

like image 116
Paul Tomblin Avatar answered Oct 18 '22 21:10

Paul Tomblin