如何减少Perl CGI脚本的启动时间? [英] How can I reduce Perl CGI script start-up time?

查看:50
本文介绍了如何减少Perl CGI脚本的启动时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一些CGI脚本,并且试图找到一种解决方案,以减少在导入带有使用功能的许多模块时产生的启动时间。

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".

更新:

提供的解决方案很好,但是我正在使用的脚本同时在控制台和CGI模式下运行,以检查是否存在一些典型的HTTP环境变量。

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.

在控制台模式下,它们正常转储数据,在 html模式下,它们进行实时替换并发送其他数据

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.

推荐答案

考虑使用 CGI :: Fast 启动一个perl进程来处理多个请求。我花了很少的精力将一些大型CGI脚本更改为CGI :: Fast。与mod_perl不同,在托管站点上运行CGI :: Fast非常容易,因为您可以在不重新启动Apache的情况下重新启动脚本(至少这是托管人在我要求mod_perl时告诉我的内容)。

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).

这篇关于如何减少Perl CGI脚本的启动时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆