]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: Precompile CGI routines for mod_perl
authorJakub Narebski <redacted>
Wed, 27 Dec 2006 23:00:52 +0000 (00:00 +0100)
committerLady <redacted>
Mon, 6 Apr 2026 04:07:11 +0000 (00:07 -0400)
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 <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index 8b257eec5e5c0d149f00b7a3faa24fa7b81f7c34b2e21da94442a5cfc100e4ff..59f41b0243a962bc5033a991fa8ff7d4396353ea5e830079fc7dac781d990c19 100755 (executable)
@@ -18,6 +18,10 @@ use File::Find qw();
 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();
This page took 0.338542 seconds and 4 git commands to generate.