gitweb: Precompile CGI routines for mod_perl
authorJakub Narebski <jnareb@gmail.com>
Wed, 27 Dec 2006 23:00:52 +0000 (00:00 +0100)
committerJunio C Hamano <junkio@cox.net>
Thu, 28 Dec 2006 08:57:31 +0000 (00:57 -0800)
Following advice from CGI(3pm) man page, precompile all CGI routines
for mod_perl, in the BEGIN block.

If you want to compile without importing use the compile() method
instead:

use CGI();
CGI->compile();

This is particularly useful in a mod_perl environment, in which you
might want to precompile all CGI routines in a startup script, and then
import the functions individually in each mod_perl script.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
gitweb/gitweb.perl
index a0a614acafe2f346e505ff5e69c21fff07f8e0c0..d845e91e202233916a91a7095e4a81142687c9c7 100755 (executable)
 use File::Basename qw(basename);
 binmode STDOUT, ':utf8';
 
+BEGIN {
+       CGI->compile() if $ENV{MOD_PERL};
+}
+
 our $cgi = new CGI;
 our $version = "++GIT_VERSION++";
 our $my_url = $cgi->url();