[英]How can my Perl program tell if is running under mod_perl?
How can my Perl program tell if is running under mod_perl? 我的Perl程序如何判断是否在mod_perl下运行?
I'm thinking along the lines of global variables or environment variables. 我正在考虑全局变量或环境变量。
I am only bothered about mod_perl >= 2. 我只对mod_perl> = 2感到困扰。
According to "Environment Variables" in the mod_perl user's guide : 根据mod_perl用户指南中的“环境变量” :
$ENV{MOD_PERL}
- is set to the mod_perl version the server is running under.$ENV{MOD_PERL}
- 设置为运行服务器的mod_perl版本。 eg: 例如:mod_perl/2.000002 的mod_perl / 2.000002If
$ENV{MOD_PERL}
doesn't exist, most likely you are not running under mod_perl. 如果$ENV{MOD_PERL}
不存在,很可能你没有在mod_perl下运行。die "I refuse to work without mod_perl!" 死“我拒绝在没有mod_perl的情况下工作!” unless exists $ENV{MOD_PERL}; 除非存在$ ENV {MOD_PERL};
(see the above link for more information). (有关更多信息,请参阅上面的链接)。
http://perl.apache.org/docs/2.0/user/coding/coding.html#Environment_Variables说会有一个环境变量MOD_PERL
,所以你可以使用表达式来测试它
exists $ENV{MOD_PERL}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.