From: Jakub Narebski Date: Mon, 14 Jun 2010 16:08:13 GMT Subject: [RFC PATCHv4 01/17] gitweb: Return or exit after done serving request Message-ID: <1276531710-22945-2-git-send-email-jnareb@gmail.com> In-Reply-To: <1276531710-22945-1-git-send-email-jnareb@gmail.com> 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 --- gitweb/gitweb.perl | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 934aacb..c54a8a8 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -987,7 +987,17 @@ if ($action !~ m/^(?:opml|project_list|project_index)$/ && die_error(400, "Project needed"); } $actions{$action}->(); + DONE_GITWEB: +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 + # or 'exit' hijacked approprietly + exit; +} 1; ## ====================================================================== -- 1.7.0.1