{"thread":{"id":"5375","subject":"Running gitweb under mod_perl","startedAt":"2006-08-24T12:43:06Z","lastAt":"2006-09-05T20:32:21Z","messageCount":12,"participants":["Jakub Narebski","Johannes Schindelin","Dennis Stosberg","Randal L. Schwartz"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"25847","messageId":"eck6sq$agn$1@sea.gmane.org","threadId":"5375","inReplyTo":null,"subject":"Running gitweb under mod_perl","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-08-24T12:43:06Z","receivedAt":"2006-08-24T12:43:06Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Could you tell me what should I do to run gitweb under mod_perl,\nand not as CGI script? What should I put in Apache configuration\n(Apache 2.0.54 if this matters, mod_perl 2.0.1)\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"25848","messageId":"Pine.LNX.4.63.0608241445420.28360@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"5375","inReplyTo":"eck6sq$agn$1@sea.gmane.org","subject":"Re: Running gitweb under mod_perl","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-08-24T12:46:19Z","receivedAt":"2006-08-24T12:46:19Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 24 Aug 2006, Jakub Narebski wrote:\n\n> Could you tell me what should I do to run gitweb under mod_perl,\n> and not as CGI script? What should I put in Apache configuration\n> (Apache 2.0.54 if this matters, mod_perl 2.0.1)\n\nI have not checked closely, but it seems that git-instaweb supports \nmod_perl. Maybe you can find out what you have to do by inspecting \ngit-instaweb?\n\nHth,\nDscho\n"},{"id":"25850","messageId":"20060824140525.G638085b@leonov.stosberg.net","threadId":"5375","inReplyTo":"eck6sq$agn$1@sea.gmane.org","subject":"Re: Running gitweb under mod_perl","fromName":"Dennis Stosberg","fromEmail":"dennis@stosberg.net","sentAt":"2006-08-24T14:05:26Z","receivedAt":"2006-08-24T14:05:26Z","isPatch":false,"sender":{"key":"dennis@stosberg.net","avatar":null},"body":"Jakub Narebski wrote:\n\n> Could you tell me what should I do to run gitweb under mod_perl,\n> and not as CGI script? \n\nAbout two months ago I sent a set of three patches that made gitweb\nrun with Apache::Registry:\n\n  http://marc.theaimsgroup.com/?l=git&m=115089541911624\n\nThe first two patches have found their way into git, so the only\nthing left to do is to change the way the path to the git repository\nis passed to the git commands.\n\nI haven't updated that patch since then and with all the refactoring\ngitweb has seen it surely won't apply anymore, but if there's\ninterest I can rebase it to current \"next\".\n\n> What should I put in Apache configuration (Apache 2.0.54 if this\n> matters, mod_perl 2.0.1) \n\n>From my configuration:\n\n  <Directory /home/dennis/public_html/perl>\n    Options -Indexes +ExecCGI\n    AllowOverride None\n    PerlSendHeader On\n    SetHandler perl-script\n    PerlHandler ModPerl::Registry\n  </Directory>\n\nRegards,\nDennis\n"},{"id":"25851","messageId":"20060824151246.G465d67c8@leonov.stosberg.net","threadId":"5375","inReplyTo":"20060824140525.G638085b@leonov.stosberg.net","subject":"[PATCH] gitweb: Use --git-dir parameter instead of setting $ENV{'GIT_DIR'}","fromName":"Dennis Stosberg","fromEmail":"dennis@stosberg.net","sentAt":"2006-08-24T15:12:46Z","receivedAt":"2006-08-24T15:12:46Z","isPatch":true,"sender":{"key":"dennis@stosberg.net","avatar":null},"body":"This makes it possible to run gitweb under mod_perl's Apache::Registry.\n\nSigned-off-by: Dennis Stosberg <dennis@stosberg.net>\n---\nGitweb has changed a lot since I last looked into it two months ago,\nso this patch is a little different from the former one.  Only very\nsuperficially tested, but seems to work well.\n\n gitweb/gitweb.perl |   73 +++++++++++++++++++++++++++++-----------------------\n 1 files changed, 41 insertions(+), 32 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex ae13e3e..73b3663 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -65,6 +65,9 @@ require $GITWEB_CONFIG if -e $GITWEB_CON\n # version of the core git binary\n our $git_version = qx($GIT --version) =~ m/git version (.*)$/ ? $1 : \"unknown\";\n \n+# path to the current git repository\n+our $git_dir;\n+\n $projects_list ||= $projectroot;\n if (! -d $git_temp) {\n \tmkdir($git_temp, 0700) || die_error(undef, \"Couldn't mkdir $git_temp\");\n@@ -99,7 +102,7 @@ if (defined $project && $project) {\n \tif (!(-e \"$projectroot/$project/HEAD\")) {\n \t\tdie_error(undef, \"No such project\");\n \t}\n-\t$ENV{'GIT_DIR'} = \"$projectroot/$project\";\n+\t$git_dir = \"$projectroot/$project\";\n } else {\n \tgit_project_list();\n \texit;\n@@ -375,21 +378,26 @@ sub git_get_referencing {\n ## ----------------------------------------------------------------------\n ## git utility subroutines, invoking git commands\n \n+# returns path to the core git executable and the --git-dir parameter\n+sub git_cmd {\n+    return $GIT, '--git-dir='.$git_dir;\n+}\n+\n # get HEAD ref of given project as hash\n sub git_read_head {\n \tmy $project = shift;\n-\tmy $oENV = $ENV{'GIT_DIR'};\n+\tmy $o_git_dir = $git_dir;\n \tmy $retval = undef;\n-\t$ENV{'GIT_DIR'} = \"$projectroot/$project\";\n-\tif (open my $fd, \"-|\", $GIT, \"rev-parse\", \"--verify\", \"HEAD\") {\n+\t$git_dir = \"$projectroot/$project\";\n+\tif (open my $fd, \"-|\", git_cmd(), \"rev-parse\", \"--verify\", \"HEAD\") {\n \t\tmy $head = <$fd>;\n \t\tclose $fd;\n \t\tif (defined $head && $head =~ /^([0-9a-fA-F]{40})$/) {\n \t\t\t$retval = $1;\n \t\t}\n \t}\n-\tif (defined $oENV) {\n-\t\t$ENV{'GIT_DIR'} = $oENV;\n+\tif (defined $o_git_dir) {\n+\t\t$git_dir = $o_git_dir;\n \t}\n \treturn $retval;\n }\n@@ -398,7 +406,7 @@ # get type of given object\n sub git_get_type {\n \tmy $hash = shift;\n \n-\topen my $fd, \"-|\", $GIT, \"cat-file\", '-t', $hash or return;\n+\topen my $fd, \"-|\", git_cmd(), \"cat-file\", '-t', $hash or return;\n \tmy $type = <$fd>;\n \tclose $fd or return;\n \tchomp $type;\n@@ -412,7 +420,8 @@ sub git_get_project_config {\n \t$key =~ s/^gitweb\\.//;\n \treturn if ($key =~ m/\\W/);\n \n-\tmy $val = qx($GIT repo-config --get gitweb.$key);\n+\tmy $git_command = join(' ', git_cmd());\n+\tmy $val = qx($git_command repo-config --get gitweb.$key);\n \treturn ($val);\n }\n \n@@ -431,7 +440,7 @@ sub git_get_hash_by_path {\n \n \tmy $tree = $base;\n \n-\topen my $fd, \"-|\", $GIT, \"ls-tree\", $base, \"--\", $path\n+\topen my $fd, \"-|\", git_cmd(), \"ls-tree\", $base, \"--\", $path\n \t\tor die_error(undef, \"Open git-ls-tree failed\");\n \tmy $line = <$fd>;\n \tclose $fd or return undef;\n@@ -566,7 +575,7 @@ sub git_read_tag {\n \tmy %tag;\n \tmy @comment;\n \n-\topen my $fd, \"-|\", $GIT, \"cat-file\", \"tag\", $tag_id or return;\n+\topen my $fd, \"-|\", git_cmd(), \"cat-file\", \"tag\", $tag_id or return;\n \t$tag{'id'} = $tag_id;\n \twhile (my $line = <$fd>) {\n \t\tchomp $line;\n@@ -607,7 +616,7 @@ sub git_read_commit {\n \t\t@commit_lines = @$commit_text;\n \t} else {\n \t\t$/ = \"\\0\";\n-\t\topen my $fd, \"-|\", $GIT, \"rev-list\", \"--header\", \"--parents\", \"--max-count=1\", $commit_id or return;\n+\t\topen my $fd, \"-|\", git_cmd(), \"rev-list\", \"--header\", \"--parents\", \"--max-count=1\", $commit_id or return;\n \t\t@commit_lines = split '\\n', <$fd>;\n \t\tclose $fd or return;\n \t\t$/ = \"\\n\";\n@@ -1219,7 +1228,7 @@ sub git_diff_print {\n \tif (defined $from) {\n \t\t$from_tmp = \"$git_temp/gitweb_\" . $$ . \"_from\";\n \t\topen my $fd2, \"> $from_tmp\";\n-\t\topen my $fd, \"-|\", $GIT, \"cat-file\", \"blob\", $from;\n+\t\topen my $fd, \"-|\", git_cmd(), \"cat-file\", \"blob\", $from;\n \t\tmy @file = <$fd>;\n \t\tprint $fd2 @file;\n \t\tclose $fd2;\n@@ -1230,7 +1239,7 @@ sub git_diff_print {\n \tif (defined $to) {\n \t\t$to_tmp = \"$git_temp/gitweb_\" . $$ . \"_to\";\n \t\topen my $fd2, \"> $to_tmp\";\n-\t\topen my $fd, \"-|\", $GIT, \"cat-file\", \"blob\", $to;\n+\t\topen my $fd, \"-|\", git_cmd(), \"cat-file\", \"blob\", $to;\n \t\tmy @file = <$fd>;\n \t\tprint $fd2 @file;\n \t\tclose $fd2;\n@@ -1292,7 +1301,7 @@ sub git_project_list {\n \t\tif (!defined $head) {\n \t\t\tnext;\n \t\t}\n-\t\t$ENV{'GIT_DIR'} = \"$projectroot/$pr->{'path'}\";\n+\t\t$git_dir = \"$projectroot/$pr->{'path'}\";\n \t\tmy %co = git_read_commit($head);\n \t\tif (!%co) {\n \t\t\tnext;\n@@ -1418,7 +1427,7 @@ sub git_summary {\n \t      \"<tr><td>last change</td><td>$cd{'rfc2822'}</td></tr>\\n\" .\n \t      \"</table>\\n\";\n \n-\topen my $fd, \"-|\", $GIT, \"rev-list\", \"--max-count=17\", git_read_head($project)\n+\topen my $fd, \"-|\", git_cmd(), \"rev-list\", \"--max-count=17\", git_read_head($project)\n \t\tor die_error(undef, \"Open git-rev-list failed\");\n \tmy @revlist = map { chomp; $_ } <$fd>;\n \tclose $fd;\n@@ -1489,7 +1498,7 @@ sub git_blame2 {\n \tif ($ftype !~ \"blob\") {\n \t\tdie_error(\"400 Bad Request\", \"Object is not a blob\");\n \t}\n-\topen ($fd, \"-|\", $GIT, \"blame\", '-l', $file_name, $hash_base)\n+\topen ($fd, \"-|\", git_cmd(), \"blame\", '-l', $file_name, $hash_base)\n \t\tor die_error(undef, \"Open git-blame failed\");\n \tgit_header_html();\n \tmy $formats_nav =\n@@ -1543,7 +1552,7 @@ sub git_blame {\n \t\t$hash = git_get_hash_by_path($hash_base, $file_name, \"blob\")\n \t\t\tor die_error(undef, \"Error lookup file\");\n \t}\n-\topen ($fd, \"-|\", $GIT, \"annotate\", '-l', '-t', '-r', $file_name, $hash_base)\n+\topen ($fd, \"-|\", git_cmd(), \"annotate\", '-l', '-t', '-r', $file_name, $hash_base)\n \t\tor die_error(undef, \"Open git-annotate failed\");\n \tgit_header_html();\n \tmy $formats_nav =\n@@ -1654,7 +1663,7 @@ sub git_blob_plain {\n \t\t}\n \t}\n \tmy $type = shift;\n-\topen my $fd, \"-|\", $GIT, \"cat-file\", \"blob\", $hash\n+\topen my $fd, \"-|\", git_cmd(), \"cat-file\", \"blob\", $hash\n \t\tor die_error(undef, \"Couldn't cat $file_name, $hash\");\n \n \t$type ||= git_blob_plain_mimetype($fd, $file_name);\n@@ -1687,7 +1696,7 @@ sub git_blob {\n \t\t}\n \t}\n \tmy $have_blame = git_get_project_config_bool ('blame');\n-\topen my $fd, \"-|\", $GIT, \"cat-file\", \"blob\", $hash\n+\topen my $fd, \"-|\", git_cmd(), \"cat-file\", \"blob\", $hash\n \t\tor die_error(undef, \"Couldn't cat $file_name, $hash\");\n \tmy $mimetype = git_blob_plain_mimetype($fd, $file_name);\n \tif ($mimetype !~ m/^text\\//) {\n@@ -1740,7 +1749,7 @@ sub git_tree {\n \t\t}\n \t}\n \t$/ = \"\\0\";\n-\topen my $fd, \"-|\", $GIT, \"ls-tree\", '-z', $hash\n+\topen my $fd, \"-|\", git_cmd(), \"ls-tree\", '-z', $hash\n \t\tor die_error(undef, \"Open git-ls-tree failed\");\n \tmy @entries = map { chomp; $_ } <$fd>;\n \tclose $fd or die_error(undef, \"Reading tree failed\");\n@@ -1821,7 +1830,7 @@ sub git_log {\n \tmy $refs = read_info_ref();\n \n \tmy $limit = sprintf(\"--max-count=%i\", (100 * ($page+1)));\n-\topen my $fd, \"-|\", $GIT, \"rev-list\", $limit, $hash\n+\topen my $fd, \"-|\", git_cmd(), \"rev-list\", $limit, $hash\n \t\tor die_error(undef, \"Open git-rev-list failed\");\n \tmy @revlist = map { chomp; $_ } <$fd>;\n \tclose $fd;\n@@ -1892,7 +1901,7 @@ sub git_commit {\n \tif (!defined $parent) {\n \t\t$parent = \"--root\";\n \t}\n-\topen my $fd, \"-|\", $GIT, \"diff-tree\", '-r', '-M', $parent, $hash\n+\topen my $fd, \"-|\", git_cmd(), \"diff-tree\", '-r', '-M', $parent, $hash\n \t\tor die_error(undef, \"Open git-diff-tree failed\");\n \tmy @difftree = map { chomp; $_ } <$fd>;\n \tclose $fd or die_error(undef, \"Reading git-diff-tree failed\");\n@@ -2116,7 +2125,7 @@ sub git_commitdiff {\n \tif (!defined $hash_parent) {\n \t\t$hash_parent = $co{'parent'} || '--root';\n \t}\n-\topen my $fd, \"-|\", $GIT, \"diff-tree\", '-r', $hash_parent, $hash\n+\topen my $fd, \"-|\", git_cmd(), \"diff-tree\", '-r', $hash_parent, $hash\n \t\tor die_error(undef, \"Open git-diff-tree failed\");\n \tmy @difftree = map { chomp; $_ } <$fd>;\n \tclose $fd or die_error(undef, \"Reading git-diff-tree failed\");\n@@ -2207,7 +2216,7 @@ sub git_commitdiff_plain {\n \tif (!defined $hash_parent) {\n \t\t$hash_parent = $co{'parent'} || '--root';\n \t}\n-\topen my $fd, \"-|\", $GIT, \"diff-tree\", '-r', $hash_parent, $hash\n+\topen my $fd, \"-|\", git_cmd(), \"diff-tree\", '-r', $hash_parent, $hash\n \t\tor die_error(undef, \"Open git-diff-tree failed\");\n \tmy @difftree = map { chomp; $_ } <$fd>;\n \tclose $fd or die_error(undef, \"Reading diff-tree failed\");\n@@ -2215,7 +2224,7 @@ sub git_commitdiff_plain {\n \t# try to figure out the next tag after this commit\n \tmy $tagname;\n \tmy $refs = read_info_ref(\"tags\");\n-\topen $fd, \"-|\", $GIT, \"rev-list\", \"HEAD\";\n+\topen $fd, \"-|\", git_cmd(), \"rev-list\", \"HEAD\";\n \tmy @commits = map { chomp; $_ } <$fd>;\n \tclose $fd;\n \tforeach my $commit (@commits) {\n@@ -2284,7 +2293,7 @@ sub git_history {\n \tgit_print_page_path($file_name, $ftype);\n \n \topen my $fd, \"-|\",\n-\t\t$GIT, \"rev-list\", \"--full-history\", $hash_base, \"--\", $file_name;\n+\t\tgit_cmd(), \"rev-list\", \"--full-history\", $hash_base, \"--\", $file_name;\n \tprint \"<table cellspacing=\\\"0\\\">\\n\";\n \tmy $alternate = 0;\n \twhile (my $line = <$fd>) {\n@@ -2358,7 +2367,7 @@ sub git_search {\n \tmy $alternate = 0;\n \tif ($commit_search) {\n \t\t$/ = \"\\0\";\n-\t\topen my $fd, \"-|\", $GIT, \"rev-list\", \"--header\", \"--parents\", $hash or next;\n+\t\topen my $fd, \"-|\", git_cmd(), \"rev-list\", \"--header\", \"--parents\", $hash or next;\n \t\twhile (my $commit_text = <$fd>) {\n \t\t\tif (!grep m/$searchtext/i, $commit_text) {\n \t\t\t\tnext;\n@@ -2408,7 +2417,7 @@ sub git_search {\n \n \tif ($pickaxe_search) {\n \t\t$/ = \"\\n\";\n-\t\topen my $fd, \"-|\", \"$GIT rev-list $hash | $GIT diff-tree -r --stdin -S\\'$searchtext\\'\";\n+\t\topen my $fd, \"-|\", git_cmd().\" rev-list $hash | \".git_cmd().\" diff-tree -r --stdin -S\\'$searchtext\\'\";\n \t\tundef %co;\n \t\tmy @files;\n \t\twhile (my $line = <$fd>) {\n@@ -2471,7 +2480,7 @@ sub git_shortlog {\n \tmy $refs = read_info_ref();\n \n \tmy $limit = sprintf(\"--max-count=%i\", (100 * ($page+1)));\n-\topen my $fd, \"-|\", $GIT, \"rev-list\", $limit, $hash\n+\topen my $fd, \"-|\", git_cmd(), \"rev-list\", $limit, $hash\n \t\tor die_error(undef, \"Open git-rev-list failed\");\n \tmy @revlist = map { chomp; $_ } <$fd>;\n \tclose $fd;\n@@ -2499,7 +2508,7 @@ ## feeds (RSS, OPML)\n \n sub git_rss {\n \t# http://www.notestips.com/80256B3A007F2692/1/NAMO5P9UPQ\n-\topen my $fd, \"-|\", $GIT, \"rev-list\", \"--max-count=150\", git_read_head($project)\n+\topen my $fd, \"-|\", git_cmd(), \"rev-list\", \"--max-count=150\", git_read_head($project)\n \t\tor die_error(undef, \"Open git-rev-list failed\");\n \tmy @revlist = map { chomp; $_ } <$fd>;\n \tclose $fd or die_error(undef, \"Reading git-rev-list failed\");\n@@ -2520,7 +2529,7 @@ sub git_rss {\n \t\t\tlast;\n \t\t}\n \t\tmy %cd = date_str($co{'committer_epoch'});\n-\t\topen $fd, \"-|\", $GIT, \"diff-tree\", '-r', $co{'parent'}, $co{'id'} or next;\n+\t\topen $fd, \"-|\", git_cmd(), \"diff-tree\", '-r', $co{'parent'}, $co{'id'} or next;\n \t\tmy @difftree = map { chomp; $_ } <$fd>;\n \t\tclose $fd or next;\n \t\tprint \"<item>\\n\" .\n@@ -2573,7 +2582,7 @@ sub git_opml {\n \t\tif (!defined $head) {\n \t\t\tnext;\n \t\t}\n-\t\t$ENV{'GIT_DIR'} = \"$projectroot/$proj{'path'}\";\n+\t\t$git_dir = \"$projectroot/$proj{'path'}\";\n \t\tmy %co = git_read_commit($head);\n \t\tif (!%co) {\n \t\t\tnext;\n-- \n1.4.2\n"},{"id":"25859","messageId":"eckor9$jje$1@sea.gmane.org","threadId":"5375","inReplyTo":"eck6sq$agn$1@sea.gmane.org","subject":"Re: Running gitweb under mod_perl","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-08-24T17:49:30Z","receivedAt":"2006-08-24T17:49:30Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"By the way, does the \"static\" variables works under mod_perl? i.e.\n\n{\n  my $private_var = \"something\"\n\n  sub some_sub {\n    ...\n  }\n\n  sub other_sub {\n    ...\n  }\n}\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"25864","messageId":"20060824193220.G4a28fdc4@leonov.stosberg.net","threadId":"5375","inReplyTo":"eckor9$jje$1@sea.gmane.org","subject":"Re: Running gitweb under mod_perl","fromName":"Dennis Stosberg","fromEmail":"dennis@stosberg.net","sentAt":"2006-08-24T19:32:21Z","receivedAt":"2006-08-24T19:32:21Z","isPatch":false,"sender":{"key":"dennis@stosberg.net","avatar":null},"body":"Jakub Narebski wrote:\n\n> By the way, does the \"static\" variables works under mod_perl? i.e.\n> \n> {\n>   my $private_var = \"something\"\n> \n>   sub some_sub {\n>     ...\n>   }\n> \n>   sub other_sub {\n>     ...\n>   }\n> }\n\nDepends on what you expect.  The variable will remain shared between\nthose subs over successive executions, but it will not be reinitialised\nto \"something\" -- at least not visibly to the subs:\n\nOn the first invocation, $private_var is initialised and the two\nsubroutines are created.  Internally, they refer to the _instance_ of\n$private_var.  The next time the script is run by mod_perl, $private_var\ngets initialised again, but the subs are persistent and still refer to\nthe old instance.  _Their_ copy of the variable will still be shared\nbetween them, but it will not be reset to \"something\".\n\nSo it should work, but I would avoid such a construction if possible.\n\nApache::Registry wraps the whole script in another function, which\nis called on each request, so your piece of code really looks somewhat\nlike this:\n\n#!/usr/bin/perl\nsub handler {\n    # do something\n    {\n        my $a = 'A';\n\tsub sub_a { $a .= 'B' }\n\tsub sub_b { print $a.\"\\n\" }\n    }\n    sub_a();\n    sub_b();\n}\nfor(1..10) { handler() }\n\nRegards,\nDennis\n"},{"id":"25868","messageId":"ecl3v4$s14$1@sea.gmane.org","threadId":"5375","inReplyTo":"20060824193220.G4a28fdc4@leonov.stosberg.net","subject":"Re: Running gitweb under mod_perl","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-08-24T20:59:18Z","receivedAt":"2006-08-24T20:59:18Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Dennis Stosberg wrote:\n\n> Jakub Narebski wrote:\n> \n>> By the way, does the \"static\" variables works under mod_perl? i.e.\n>> \n>> {\n>>   my $private_var = \"something\"\n>> \n>>   sub some_sub {\n>>     ...\n>>   }\n>> \n>>   sub other_sub {\n>>     ...\n>>   }\n>> }\n> \n> Depends on what you expect.  The variable will remain shared between\n> those subs over successive executions, but it will not be reinitialised\n> to \"something\" -- at least not visibly to the subs:\n\nWell, I wanted to share read-only variable, initialized once and not\nchanged at all. It could be global variable, but it is used only by\nthose two functions.\n\n> On the first invocation, $private_var is initialised and the two\n> subroutines are created.  Internally, they refer to the _instance_ of\n> $private_var.  The next time the script is run by mod_perl, $private_var\n> gets initialised again, but the subs are persistent and still refer to\n> the old instance.  _Their_ copy of the variable will still be shared\n> between them, but it will not be reset to \"something\".\n\nI don't need to reinitialize $private_var -- it is not changed. \n\n> Apache::Registry wraps the whole script in another function, which\n> is called on each request, so your piece of code really looks somewhat\n> like this:\n> \n> #!/usr/bin/perl\n> sub handler {\n>     # do something\n>     {\n>         my $a = 'A';\n>         sub sub_a { $a .= 'B' }\n>         sub sub_b { print $a.\"\\n\" }\n>     }\n>     sub_a();\n>     sub_b();\n> }\n> for(1..10) { handler() }\n\nThanks for an explanation.\n\nIs there any way to check at _runtime_ if script is run under mod_perl,\nor would it be simplier (after script reorganization) for install time\nselection of using CGI, FastCGI, or Apache2::something...?\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"25881","messageId":"86lkpdobwd.fsf@blue.stonehenge.com","threadId":"5375","inReplyTo":"ecl3v4$s14$1@sea.gmane.org","subject":"Re: Running gitweb under mod_perl","fromName":"Randal L. Schwartz","fromEmail":"merlyn@stonehenge.com","sentAt":"2006-08-25T01:13:38Z","receivedAt":"2006-08-25T01:13:38Z","isPatch":false,"sender":{"key":"merlyn@stonehenge.com","avatar":"https://gravatar.com/avatar/dc528d210743ff0333e6213f9ee7b33b23f1b7bc1f3c5a8c2d819074ecd7ab19?d=mp&s=160"},"body":">>>>> \"Jakub\" == Jakub Narebski <jnareb@gmail.com> writes:\n\nJakub> Is there any way to check at _runtime_ if script is run under mod_perl,\nJakub> or would it be simplier (after script reorganization) for install time\nJakub> selection of using CGI, FastCGI, or Apache2::something...?\n\nYeah, look at the first few dozen lines of CGI.pm - it has to do different\nthings based on whether it's being run under mod_perl.\n\n-- \nRandal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095\n<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>\nPerl/Unix/security consulting, Technical writing, Comedy, etc. etc.\nSee PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!\n"},{"id":"26050","messageId":"11567801982990-git-send-email-jnareb@gmail.com","threadId":"5375","inReplyTo":"20060824151246.G465d67c8@leonov.stosberg.net","subject":"[PATCH (amend)] gitweb: Use --git-dir parameter instead of setting $ENV{'GIT_DIR'}","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-08-28T15:49:58Z","receivedAt":"2006-08-28T15:49:58Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"From: Dennis Stosberg <dennis@stosberg.net>\n\nThis makes it possible to run gitweb under mod_perl's Apache::Registry.\n\nSigned-off-by: Dennis Stosberg <dennis@stosberg.net>\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nUpdated to the 'next' version (v1.4.2-gc6063de).\n\nIt needs fairly new git version, with --git-dir=<path> parameter\nto git wrapper, i.e. post v1.4.2-rc2-g6acbcb9 version.\n\nDennis, could you check that it works for you in 'next'\nversion of gitweb? The patch you sent is pre-rename even...\n\n gitweb/gitweb.perl |   90 +++++++++++++++++++++++++++++++---------------------\n 1 files changed, 54 insertions(+), 36 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex ef09cf5..f421825 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -157,6 +157,9 @@ require $GITWEB_CONFIG if -e $GITWEB_CON\n # version of the core git binary\n our $git_version = qx($GIT --version) =~ m/git version (.*)$/ ? $1 : \"unknown\";\n \n+# path to the current git repository\n+our $git_dir;\n+\n $projects_list ||= $projectroot;\n \n # ======================================================================\n@@ -184,7 +187,7 @@ if (defined $project) {\n \tif (!(-e \"$projectroot/$project/HEAD\")) {\n \t\tdie_error(undef, \"No such project\");\n \t}\n-\t$ENV{'GIT_DIR'} = \"$projectroot/$project\";\n+\t$git_dir = \"$projectroot/$project\";\n }\n \n our $file_name = $cgi->param('f');\n@@ -572,21 +575,31 @@ sub format_diff_line {\n ## ----------------------------------------------------------------------\n ## git utility subroutines, invoking git commands\n \n+# returns path to the core git executable and the --git-dir parameter as list\n+sub git_cmd {\n+\treturn $GIT, '--git-dir='.$git_dir;\n+}\n+\n+# returns path to the core git executable and the --git-dir parameter as string\n+sub git_cmd_str {\n+\treturn join(' ', git_cmd());\n+}\n+\n # get HEAD ref of given project as hash\n sub git_get_head_hash {\n \tmy $project = shift;\n-\tmy $oENV = $ENV{'GIT_DIR'};\n+\tmy $o_git_dir = $git_dir;\n \tmy $retval = undef;\n-\t$ENV{'GIT_DIR'} = \"$projectroot/$project\";\n-\tif (open my $fd, \"-|\", $GIT, \"rev-parse\", \"--verify\", \"HEAD\") {\n+\t$git_dir = \"$projectroot/$project\";\n+\tif (open my $fd, \"-|\", git_cmd(), \"rev-parse\", \"--verify\", \"HEAD\") {\n \t\tmy $head = <$fd>;\n \t\tclose $fd;\n \t\tif (defined $head && $head =~ /^([0-9a-fA-F]{40})$/) {\n \t\t\t$retval = $1;\n \t\t}\n \t}\n-\tif (defined $oENV) {\n-\t\t$ENV{'GIT_DIR'} = $oENV;\n+\tif (defined $o_git_dir) {\n+\t\t$git_dir = $o_git_dir;\n \t}\n \treturn $retval;\n }\n@@ -595,7 +608,7 @@ # get type of given object\n sub git_get_type {\n \tmy $hash = shift;\n \n-\topen my $fd, \"-|\", $GIT, \"cat-file\", '-t', $hash or return;\n+\topen my $fd, \"-|\", git_cmd(), \"cat-file\", '-t', $hash or return;\n \tmy $type = <$fd>;\n \tclose $fd or return;\n \tchomp $type;\n@@ -609,7 +622,7 @@ sub git_get_project_config {\n \t$key =~ s/^gitweb\\.//;\n \treturn if ($key =~ m/\\W/);\n \n-\tmy @x = ($GIT, 'repo-config');\n+\tmy @x = (git_cmd(), 'repo-config');\n \tif (defined $type) { push @x, $type; }\n \tpush @x, \"--get\";\n \tpush @x, \"gitweb.$key\";\n@@ -625,7 +638,7 @@ sub git_get_hash_by_path {\n \n \tmy $tree = $base;\n \n-\topen my $fd, \"-|\", $GIT, \"ls-tree\", $base, \"--\", $path\n+\topen my $fd, \"-|\", git_cmd(), \"ls-tree\", $base, \"--\", $path\n \t\tor die_error(undef, \"Open git-ls-tree failed\");\n \tmy $line = <$fd>;\n \tclose $fd or return undef;\n@@ -756,7 +769,7 @@ sub git_get_references {\n \t\topen $fd, \"$projectroot/$project/info/refs\"\n \t\t\tor return;\n \t} else {\n-\t\topen $fd, \"-|\", $GIT, \"ls-remote\", \".\"\n+\t\topen $fd, \"-|\", git_cmd(), \"ls-remote\", \".\"\n \t\t\tor return;\n \t}\n \n@@ -777,7 +790,7 @@ sub git_get_references {\n sub git_get_rev_name_tags {\n \tmy $hash = shift || return undef;\n \n-\topen my $fd, \"-|\", $GIT, \"name-rev\", \"--tags\", $hash\n+\topen my $fd, \"-|\", git_cmd(), \"name-rev\", \"--tags\", $hash\n \t\tor return;\n \tmy $name_rev = <$fd>;\n \tclose $fd;\n@@ -825,7 +838,7 @@ sub parse_tag {\n \tmy %tag;\n \tmy @comment;\n \n-\topen my $fd, \"-|\", $GIT, \"cat-file\", \"tag\", $tag_id or return;\n+\topen my $fd, \"-|\", git_cmd(), \"cat-file\", \"tag\", $tag_id or return;\n \t$tag{'id'} = $tag_id;\n \twhile (my $line = <$fd>) {\n \t\tchomp $line;\n@@ -866,7 +879,7 @@ sub parse_commit {\n \t\t@commit_lines = @$commit_text;\n \t} else {\n \t\t$/ = \"\\0\";\n-\t\topen my $fd, \"-|\", $GIT, \"rev-list\", \"--header\", \"--parents\", \"--max-count=1\", $commit_id\n+\t\topen my $fd, \"-|\", git_cmd(), \"rev-list\", \"--header\", \"--parents\", \"--max-count=1\", $commit_id\n \t\t\tor return;\n \t\t@commit_lines = split '\\n', <$fd>;\n \t\tclose $fd or return;\n@@ -1971,7 +1984,7 @@ sub git_project_list {\n \t\tif (!defined $head) {\n \t\t\tnext;\n \t\t}\n-\t\t$ENV{'GIT_DIR'} = \"$projectroot/$pr->{'path'}\";\n+\t\t$git_dir = \"$projectroot/$pr->{'path'}\";\n \t\tmy %co = parse_commit($head);\n \t\tif (!%co) {\n \t\t\tnext;\n@@ -2090,7 +2103,8 @@ sub git_summary {\n \t}\n \tprint \"</table>\\n\";\n \n-\topen my $fd, \"-|\", $GIT, \"rev-list\", \"--max-count=17\", git_get_head_hash($project)\n+\topen my $fd, \"-|\", git_cmd(), \"rev-list\", \"--max-count=17\",\n+\t\tgit_get_head_hash($project)\n \t\tor die_error(undef, \"Open git-rev-list failed\");\n \tmy @revlist = map { chomp; $_ } <$fd>;\n \tclose $fd;\n@@ -2168,7 +2182,7 @@ sub git_blame2 {\n \tif ($ftype !~ \"blob\") {\n \t\tdie_error(\"400 Bad Request\", \"Object is not a blob\");\n \t}\n-\topen ($fd, \"-|\", $GIT, \"blame\", '-l', $file_name, $hash_base)\n+\topen ($fd, \"-|\", git_cmd(), \"blame\", '-l', $file_name, $hash_base)\n \t\tor die_error(undef, \"Open git-blame failed\");\n \tgit_header_html();\n \tmy $formats_nav =\n@@ -2233,7 +2247,7 @@ sub git_blame {\n \t\t$hash = git_get_hash_by_path($hash_base, $file_name, \"blob\")\n \t\t\tor die_error(undef, \"Error lookup file\");\n \t}\n-\topen ($fd, \"-|\", $GIT, \"annotate\", '-l', '-t', '-r', $file_name, $hash_base)\n+\topen ($fd, \"-|\", git_cmd(), \"annotate\", '-l', '-t', '-r', $file_name, $hash_base)\n \t\tor die_error(undef, \"Open git-annotate failed\");\n \tgit_header_html();\n \tmy $formats_nav =\n@@ -2354,7 +2368,7 @@ sub git_blob_plain {\n \t\t}\n \t}\n \tmy $type = shift;\n-\topen my $fd, \"-|\", $GIT, \"cat-file\", \"blob\", $hash\n+\topen my $fd, \"-|\", git_cmd(), \"cat-file\", \"blob\", $hash\n \t\tor die_error(undef, \"Couldn't cat $file_name, $hash\");\n \n \t$type ||= blob_mimetype($fd, $file_name);\n@@ -2396,7 +2410,7 @@ sub git_blob {\n \t\t}\n \t}\n \tmy $have_blame = gitweb_check_feature('blame');\n-\topen my $fd, \"-|\", $GIT, \"cat-file\", \"blob\", $hash\n+\topen my $fd, \"-|\", git_cmd(), \"cat-file\", \"blob\", $hash\n \t\tor die_error(undef, \"Couldn't cat $file_name, $hash\");\n \tmy $mimetype = blob_mimetype($fd, $file_name);\n \tif ($mimetype !~ m/^text\\//) {\n@@ -2461,7 +2475,7 @@ sub git_tree {\n \t\t}\n \t}\n \t$/ = \"\\0\";\n-\topen my $fd, \"-|\", $GIT, \"ls-tree\", '-z', $hash\n+\topen my $fd, \"-|\", git_cmd(), \"ls-tree\", '-z', $hash\n \t\tor die_error(undef, \"Open git-ls-tree failed\");\n \tmy @entries = map { chomp; $_ } <$fd>;\n \tclose $fd or die_error(undef, \"Reading tree failed\");\n@@ -2564,7 +2578,8 @@ sub git_snapshot {\n \t                   -content_disposition => \"inline; filename=\\\"$filename\\\"\",\n \t                   -status => '200 OK');\n \n-\topen my $fd, \"-|\", \"$GIT tar-tree $hash \\'$project\\' | $command\" or\n+\tmy $git_command = git_cmd_str();\n+\topen my $fd, \"-|\", \"$git_command tar-tree $hash \\'$project\\' | $command\" or\n \t\tdie_error(undef, \"Execute git-tar-tree failed.\");\n \tbinmode STDOUT, ':raw';\n \tprint <$fd>;\n@@ -2584,7 +2599,7 @@ sub git_log {\n \tmy $refs = git_get_references();\n \n \tmy $limit = sprintf(\"--max-count=%i\", (100 * ($page+1)));\n-\topen my $fd, \"-|\", $GIT, \"rev-list\", $limit, $hash\n+\topen my $fd, \"-|\", git_cmd(), \"rev-list\", $limit, $hash\n \t\tor die_error(undef, \"Open git-rev-list failed\");\n \tmy @revlist = map { chomp; $_ } <$fd>;\n \tclose $fd;\n@@ -2639,7 +2654,7 @@ sub git_commit {\n \tif (!defined $parent) {\n \t\t$parent = \"--root\";\n \t}\n-\topen my $fd, \"-|\", $GIT, \"diff-tree\", '-r', @diff_opts, $parent, $hash\n+\topen my $fd, \"-|\", git_cmd(), \"diff-tree\", '-r', @diff_opts, $parent, $hash\n \t\tor die_error(undef, \"Open git-diff-tree failed\");\n \tmy @difftree = map { chomp; $_ } <$fd>;\n \tclose $fd or die_error(undef, \"Reading git-diff-tree failed\");\n@@ -2746,7 +2761,7 @@ sub git_blobdiff {\n \tif (defined $hash_base && defined $hash_parent_base) {\n \t\tif (defined $file_name) {\n \t\t\t# read raw output\n-\t\t\topen $fd, \"-|\", $GIT, \"diff-tree\", '-r', @diff_opts, $hash_parent_base, $hash_base,\n+\t\t\topen $fd, \"-|\", git_cmd(), \"diff-tree\", '-r', @diff_opts, $hash_parent_base, $hash_base,\n \t\t\t\t\"--\", $file_name\n \t\t\t\tor die_error(undef, \"Open git-diff-tree failed\");\n \t\t\t@difftree = map { chomp; $_ } <$fd>;\n@@ -2760,7 +2775,7 @@ sub git_blobdiff {\n \t\t\t# try to find filename from $hash\n \n \t\t\t# read filtered raw output\n-\t\t\topen $fd, \"-|\", $GIT, \"diff-tree\", '-r', @diff_opts, $hash_parent_base, $hash_base\n+\t\t\topen $fd, \"-|\", git_cmd(), \"diff-tree\", '-r', @diff_opts, $hash_parent_base, $hash_base\n \t\t\t\tor die_error(undef, \"Open git-diff-tree failed\");\n \t\t\t@difftree =\n \t\t\t\t# ':100644 100644 03b21826... 3b93d5e7... M\tls-files.c'\n@@ -2794,7 +2809,7 @@ sub git_blobdiff {\n \t\t}\n \n \t\t# open patch output\n-\t\topen $fd, \"-|\", $GIT, \"diff-tree\", '-r', @diff_opts,\n+\t\topen $fd, \"-|\", git_cmd(), \"diff-tree\", '-r', @diff_opts,\n \t\t\t'-p', $hash_parent_base, $hash_base,\n \t\t\t\"--\", $file_name\n \t\t\tor die_error(undef, \"Open git-diff-tree failed\");\n@@ -2830,7 +2845,7 @@ sub git_blobdiff {\n \t\t}\n \n \t\t# open patch output\n-\t\topen $fd, \"-|\", $GIT, \"diff\", '-p', @diff_opts, $hash_parent, $hash\n+\t\topen $fd, \"-|\", git_cmd(), \"diff\", '-p', @diff_opts, $hash_parent, $hash\n \t\t\tor die_error(undef, \"Open git-diff failed\");\n \t} else  {\n \t\tdie_error('404 Not Found', \"Missing one of the blob diff parameters\")\n@@ -2915,7 +2930,7 @@ sub git_commitdiff {\n \tmy $fd;\n \tmy @difftree;\n \tif ($format eq 'html') {\n-\t\topen $fd, \"-|\", $GIT, \"diff-tree\", '-r', @diff_opts,\n+\t\topen $fd, \"-|\", git_cmd(), \"diff-tree\", '-r', @diff_opts,\n \t\t\t\"--patch-with-raw\", \"--full-index\", $hash_parent, $hash\n \t\t\tor die_error(undef, \"Open git-diff-tree failed\");\n \n@@ -2926,7 +2941,7 @@ sub git_commitdiff {\n \t\t}\n \n \t} elsif ($format eq 'plain') {\n-\t\topen $fd, \"-|\", $GIT, \"diff-tree\", '-r', @diff_opts,\n+\t\topen $fd, \"-|\", git_cmd(), \"diff-tree\", '-r', @diff_opts,\n \t\t\t'-p', $hash_parent, $hash\n \t\t\tor die_error(undef, \"Open git-diff-tree failed\");\n \n@@ -3027,7 +3042,8 @@ sub git_history {\n \tgit_print_page_path($file_name, $ftype, $hash_base);\n \n \topen my $fd, \"-|\",\n-\t\t$GIT, \"rev-list\", \"--full-history\", $hash_base, \"--\", $file_name;\n+\t\tgit_cmd(), \"rev-list\", \"--full-history\", $hash_base, \"--\", $file_name;\n+\n \tgit_history_body($fd, $refs, $hash_base, $ftype);\n \n \tclose $fd;\n@@ -3067,7 +3083,7 @@ sub git_search {\n \tmy $alternate = 0;\n \tif ($commit_search) {\n \t\t$/ = \"\\0\";\n-\t\topen my $fd, \"-|\", $GIT, \"rev-list\", \"--header\", \"--parents\", $hash or next;\n+\t\topen my $fd, \"-|\", git_cmd(), \"rev-list\", \"--header\", \"--parents\", $hash or next;\n \t\twhile (my $commit_text = <$fd>) {\n \t\t\tif (!grep m/$searchtext/i, $commit_text) {\n \t\t\t\tnext;\n@@ -3119,7 +3135,9 @@ sub git_search {\n \n \tif ($pickaxe_search) {\n \t\t$/ = \"\\n\";\n-\t\topen my $fd, \"-|\", \"$GIT rev-list $hash | $GIT diff-tree -r --stdin -S\\'$searchtext\\'\";\n+\t\tmy $git_command = git_cmd_str();\n+\t\topen my $fd, \"-|\", \"$git_command rev-list $hash | \" .\n+\t\t\t\"$git_command diff-tree -r --stdin -S\\'$searchtext\\'\";\n \t\tundef %co;\n \t\tmy @files;\n \t\twhile (my $line = <$fd>) {\n@@ -3186,7 +3204,7 @@ sub git_shortlog {\n \tmy $refs = git_get_references();\n \n \tmy $limit = sprintf(\"--max-count=%i\", (100 * ($page+1)));\n-\topen my $fd, \"-|\", $GIT, \"rev-list\", $limit, $hash\n+\topen my $fd, \"-|\", git_cmd(), \"rev-list\", $limit, $hash\n \t\tor die_error(undef, \"Open git-rev-list failed\");\n \tmy @revlist = map { chomp; $_ } <$fd>;\n \tclose $fd;\n@@ -3214,7 +3232,7 @@ ## feeds (RSS, OPML)\n \n sub git_rss {\n \t# http://www.notestips.com/80256B3A007F2692/1/NAMO5P9UPQ\n-\topen my $fd, \"-|\", $GIT, \"rev-list\", \"--max-count=150\", git_get_head_hash($project)\n+\topen my $fd, \"-|\", git_cmd(), \"rev-list\", \"--max-count=150\", git_get_head_hash($project)\n \t\tor die_error(undef, \"Open git-rev-list failed\");\n \tmy @revlist = map { chomp; $_ } <$fd>;\n \tclose $fd or die_error(undef, \"Reading git-rev-list failed\");\n@@ -3237,7 +3255,7 @@ XML\n \t\t\tlast;\n \t\t}\n \t\tmy %cd = parse_date($co{'committer_epoch'});\n-\t\topen $fd, \"-|\", $GIT, \"diff-tree\", '-r', @diff_opts,\n+\t\topen $fd, \"-|\", git_cmd(), \"diff-tree\", '-r', @diff_opts,\n \t\t\t$co{'parent'}, $co{'id'}\n \t\t\tor next;\n \t\tmy @difftree = map { chomp; $_ } <$fd>;\n@@ -3295,7 +3313,7 @@ XML\n \t\tif (!defined $head) {\n \t\t\tnext;\n \t\t}\n-\t\t$ENV{'GIT_DIR'} = \"$projectroot/$proj{'path'}\";\n+\t\t$git_dir = \"$projectroot/$proj{'path'}\";\n \t\tmy %co = parse_commit($head);\n \t\tif (!%co) {\n \t\t\tnext;\n-- \n1.4.1.1\n"},{"id":"26076","messageId":"20060829071835.G795d5eff@leonov.stosberg.net","threadId":"5375","inReplyTo":"11567801982990-git-send-email-jnareb@gmail.com","subject":"Re: [PATCH (amend)] gitweb: Use --git-dir parameter instead of setting $ENV{'GIT_DIR'}","fromName":"Dennis Stosberg","fromEmail":"dennis@stosberg.net","sentAt":"2006-08-29T07:18:35Z","receivedAt":"2006-08-29T07:18:35Z","isPatch":true,"sender":{"key":"dennis@stosberg.net","avatar":null},"body":"Jakub Narebski wrote:\n\n> Dennis, could you check that it works for you in 'next'\n> version of gitweb? The patch you sent is pre-rename even...\n\nYes, it works for me.\n\nSigned-off-by: Dennis Stosberg <dennis@stosberg.net>\n\nThere is another trivial failure with mod_perl: The configuration file\nwill only be read on the first invocation of the script.  I didn't\nnotice it until today, because I never used a configuration file before.\n\nRegards,\nDennis\n"},{"id":"26077","messageId":"20060829071902.G648e8860@leonov.stosberg.net","threadId":"5375","inReplyTo":"11567801982990-git-send-email-jnareb@gmail.com","subject":"[PATCH] use do() instead of require() to include configuration","fromName":"Dennis Stosberg","fromEmail":"dennis@stosberg.net","sentAt":"2006-08-29T07:19:02Z","receivedAt":"2006-08-29T07:19:02Z","isPatch":true,"sender":{"key":"dennis@stosberg.net","avatar":null},"body":"When run under mod_perl, require() will read and execute the configuration\nfile on the first invocation only.  On every subsequent invocation, all\nconfiguration variables will be reset to their default values.  do() reads\nand executes the configuration file unconditionally.\n\nSigned-off-by: Dennis Stosberg <dennis@stosberg.net>\n---\n gitweb/gitweb.perl |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 352236b..39ebcf4 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -152,7 +152,7 @@ # - one might want to include '-B' optio\n our @diff_opts = ('-M'); # taken from git_commit\n \n our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || \"++GITWEB_CONFIG++\";\n-require $GITWEB_CONFIG if -e $GITWEB_CONFIG;\n+do $GITWEB_CONFIG if -e $GITWEB_CONFIG;\n \n # version of the core git binary\n our $git_version = qx($GIT --version) =~ m/git version (.*)$/ ? $1 : \"unknown\";\n-- \n1.4.2\n"},{"id":"26370","messageId":"edkms4$mr9$1@sea.gmane.org","threadId":"5375","inReplyTo":"20060824140525.G638085b@leonov.stosberg.net","subject":"Re: Running gitweb under mod_perl","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-09-05T20:32:21Z","receivedAt":"2006-09-05T20:32:21Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Dennis Stosberg wrote:\n\n> Jakub Narebski wrote:\n> \n>> What should I put in Apache configuration (Apache 2.0.54 if this\n>> matters, mod_perl 2.0.1) \n> \n> From my configuration:\n> \n>   <Directory /home/dennis/public_html/perl>\n>     Options -Indexes +ExecCGI\n>     AllowOverride None\n>     PerlSendHeader On\n>     SetHandler perl-script\n>     PerlHandler ModPerl::Registry\n>   </Directory>\n\nI use mod_perl 2.0 version\n\n   Alias /perl /var/www/perl\n   <Directory /var/www/perl>\n       SetHandler perl-script\n       PerlResponseHandler ModPerl::Registry\n       PerlOptions +ParseHeaders\n       Options +ExecCGI\n   </Directory>\n\nWhat is strange that ApacheBench is showing that mod_perl is _slower_ than\nCGI version: 3003.305 [ms] (mean) CGI vs 3500.589 [ms] (mean) mod_perl\nfor summary page for git.git repository (my copy that is).\n\nI wonder if I misconfigured something...\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"}]}