From: Jakub Narebski Date: Sun, 13 Jun 2010 10:09:32 +0000 (+0200) Subject: gitweb: Return or exit after done serving request X-Git-Url: https://git.ladys.computer/Gitweb/commitdiff_plain/f3ef75f5885cafc584e6af1c4daf67c046859bd049a0036c6b5e900f1be1ce89 gitweb: Return or exit after done serving request Check if there is a caller in top frame of gitweb, and either 'return' if gitweb code is wrapped in subroutine, or 'exit' if it is not. This should avoid gitweb.cgi: Subroutine git_SOMETHING redefined at gitweb.cgi line NNN warnings in error_log when running gitweb with mod_perl (using ModPerl::Registry handler) Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- diff --git a/gitweb.perl b/gitweb.perl index 0ca1f7c..d3aa80f 100755 --- a/gitweb.perl +++ b/gitweb.perl @@ -1110,6 +1110,15 @@ sub run { run(); +if (defined caller) { + # wrapped in a subroutine processing requests, + # e.g. mod_perl with ModPerl::Registry, or PSGI with Plack::App::WrapCGI + return; +} else { + # pure CGI script, serving single request + exit; +} + ## ====================================================================== ## action links