From: Jonathan Nieder Date: Thu, 11 Nov 2010 21:42:50 GMT Subject: Re: [PATCH/RFC] gitweb: selectable configurations that change with each request Message-ID: <20101111214250.GA27048@burratino> In-Reply-To: <20101111213456.21127.36449.stgit@localhost.localdomain> Jakub Narebski wrote: > This is done by introducing $per_request_config variable: if set to code > reference, this code would be run once per request, while config file would > be parsed only once. For example gitolite's contrib/gitweb/gitweb.conf > fragment mentioned in 7f425db could be rewritten as > > our $per_request_config = sub { > $ENV{GL_USER} = ($cgi && $cgi->remote_user) || "gitweb"; > }; > > to make use of this feature. > > If $per_request_config is not a code reference, it is taken to be boolean > variable, to choose between running config file for each request > (flexibility), and running config file only once (performance in > persistent environments). > > The default value for $per_request_config is 1 (true) Flexible, fast, backward-compatible. Nice.