gitweb: Prepare for splitting gitweb
Prepare gitweb for having been split into modules that are to be installed alongside gitweb in 'lib/' subdirectory, by adding
use lib __DIR__.'/lib';
to gitweb.perl (to main gitweb script), and preparing for putting modules (relative path) in $(GITWEB_MODULES) in gitweb/Makefile.
---
This version uses shell 'for' loop, instead of make's $(foreach) function, to avoid possible problem with generating a command line that exceeded the maximum argument list length. This solution has also advantage of being more readable than original $(foreach ...) version, with its overly long lines.
This idea is based on discussion surrounding Brandon Casey's patch.
In particular Bruce Stephens's suggestion was implemented to solve
issue of empty $(GITWEB_MODULES) variable (which is in this patch),
as implemented in
[PATCH 2/2 v2] Makefile: work around ksh's failure to handle missing list argument to for loop
http://thread.gmane.org/gmane.comp.version-control.git/147796/focus=150413
This version also moves installing modules to separate install-modules target, as compared to previous version.
It also contains improvement from Pavan Kumar Sunkara, namely that target is a directory, rather than destibation filename. This might be not necessary (and not much of an improvement).
gitweb/Makefile | 14 +++++++++++++- gitweb/gitweb.perl | 9 +++++++++ 2 files changed, 22 insertions(+), 1 deletions(-)
gitweb/Makefile +13 -1
@@ -55,6 +55,7 @@ PERL_PATH ?= /usr/bin/perl bindir_SQ = $(subst ','\'',$(bindir))#' gitwebdir_SQ = $(subst ','\'',$(gitwebdir))#' gitwebstaticdir_SQ = $(subst ','\'',$(gitwebdir)/static)#' +gitweblibdir_SQ = $(subst ','\'',$(gitwebdir)/lib)#' SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))#' PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))#' DESTDIR_SQ = $(subst ','\'',$(DESTDIR))#'
@@ -145,12 +146,23 @@ gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS ### Installation rules -install: all +install: all install-modules $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebdir_SQ)' $(INSTALL) -m 755 $(GITWEB_PROGRAMS) '$(DESTDIR_SQ)$(gitwebdir_SQ)' $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)' $(INSTALL) -m 644 $(GITWEB_FILES) '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)' +install-modules: + install_dirs=$(sort $(dir $(GITWEB_MODULES))) && \ + for dir in $$install_dirs; do \ + test -d '$(DESTDIR_SQ)$(gitwebdir_SQ)/$$dir' || \ + $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebdir_SQ)/$$dir'; \ + done + gitweb_modules=$(GITWEB_MODULES) && \ + for mod in $$gitweb_modules; do \ + $(INSTALL) -m 644 $$mod '$(DESTDIR_SQ)$(gitwebdir_SQ)/$$(dirname $$mod)'; \ + done + ### Cleaning rules clean:
gitweb/gitweb.perl +9 -0
@@ -9,6 +9,14 @@ use strict; use warnings; + +use File::Spec; +# __DIR__ is taken from Dir::Self __DIR__ fragment +sub __DIR__ () { + File::Spec->rel2abs(join '', (File::Spec->splitpath(__FILE__))[0, 1]); +} +use lib __DIR__ . '/lib'; + use CGI qw(:standard :escapeHTML -nosticky); use CGI::Util qw(unescape); use CGI::Carp qw(fatalsToBrowser set_message);
@@ -16,6 +24,7 @@ use Encode; use Fcntl ':mode'; use File::Find qw(); use File::Basename qw(basename); + binmode STDOUT, ':utf8'; our $t0;
Signature · 1 line
1.7.0.1
Quoted 16 lines · Jakub Narebski
gitweb/Makefile +2
-1@@ -145,12 +146,23 @@ gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS ### Installation rules -install: all +install: all install-modules $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebdir_SQ)' $(INSTALL) -m 755 $(GITWEB_PROGRAMS) '$(DESTDIR_SQ)$(gitwebdir_SQ)' $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)' $(INSTALL) -m 644 $(GITWEB_FILES) '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)' +install-modules:
gitweb/Makefile gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS · line 165
Quoted 10 lines
gitweb/Makefile +10
-0+ install_dirs=$(sort $(dir $(GITWEB_MODULES))) && \ + for dir in $$install_dirs; do \ + test -d '$(DESTDIR_SQ)$(gitwebdir_SQ)/$$dir' || \ + $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebdir_SQ)/$$dir'; \ + done + gitweb_modules=$(GITWEB_MODULES) && \ + for mod in $$gitweb_modules; do \ + $(INSTALL) -m 644 $$mod '$(DESTDIR_SQ)$(gitwebdir_SQ)/$$(dirname $$mod)'; \ + done +
Sorry, but you lost me here. Where is GITWEB_MODULES defined (iow, what commit is this patch supposed to be applied)?
I also suspect that your assignment to "install_dirs" is completely bogus when the files listed in GITWEB_MODULES span multiple directories.
Quoted 17 lines · Junio C Hamano
Quoted 15 lines · Jakub Narebski
gitweb/Makefile +1
-1@@ -145,12 +146,23 @@ gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS ### Installation rules -install: all +install: all install-modules $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebdir_SQ)' $(INSTALL) -m 755 $(GITWEB_PROGRAMS) '$(DESTDIR_SQ)$(gitwebdir_SQ)' $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)' $(INSTALL) -m 644 $(GITWEB_FILES) '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)'
Quoted 14 lines
gitweb/Makefile gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS · line 165
Quoted 11 lines
gitweb/Makefile +11
-0+install-modules: + install_dirs=$(sort $(dir $(GITWEB_MODULES))) && \ + for dir in $$install_dirs; do \ + test -d '$(DESTDIR_SQ)$(gitwebdir_SQ)/$$dir' || \ + $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebdir_SQ)/$$dir'; \ + done + gitweb_modules=$(GITWEB_MODULES) && \ + for mod in $$gitweb_modules; do \ + $(INSTALL) -m 644 $$mod '$(DESTDIR_SQ)$(gitwebdir_SQ)/$$(dirname $$mod)'; \ + done +Sorry, but you lost me here. Where is
GITWEB_MODULESdefined (iow, what commit is this patch supposed to be applied)?
This is preparatory patch either for Pavan GSoC2010 work on splitting gitweb and adding committool / admin write capabilities, or for mine gitweb caching series split into modules (based on J.H. patch for git.kernel.org).
So currently $(GITWEB_MODULES) is not defined / empty.
Quoted 2 lines
I also suspect that your assignment to "
install_dirs" is completely bogus when the files listed inGITWEB_MODULESspan multiple directories.
install_dirs contains _list_ of directories gitweb modules are to be installed into. $(dir NAMES...)' extracts the directory-part of each file name in NAMES ('./' if there is no '/' in a file name), and $(sort LIST)' is used to remove duplicate words in LIST.
It was actually tested that it works for modularized gitweb caching, in the older form using `$(foreach ...)' rather than current shell 'for' loop.
For example with the following Makefile:
GITWEB_MODULES += GitwebCache/SimpleFileCache.pm GITWEB_MODULES += GitwebCache/Capture.pm GITWEB_MODULES += GitwebCache/Capture/SelectFH.pm GITWEB_MODULES += Gitweb/Config.pm
all: @echo $(sort $(dir $(GITWEB_MODULES)))
running 'make' results in:
Gitweb/ GitwebCache/ GitwebCache/Capture/
Signature · 2 lines
Jakub Narebski Poland
Quoted 11 lines · Jakub Narebski
Quoted 3 lines
gitweb/Makefile gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS · line 156
Quoted 3 lines
gitweb/Makefile +2
-0+install-modules: + install_dirs=$(sort $(dir $(GITWEB_MODULES))) && \For example with the following
Makefile:
GITWEB_MODULES+= GitwebCache/SimpleFileCache.pmGITWEB_MODULES+= GitwebCache/Capture.pmGITWEB_MODULES+= GitwebCache/Capture/SelectFH.pmGITWEB_MODULES+= Gitweb/Config.pm
Quoted 6 lines
all: @echo $(sort $(dir $(GITWEB_MODULES)))running 'make' results in:
Gitweb/ GitwebCache/ GitwebCache/Capture/
Try replacing that with:
all:
install_dirs=$(sort $(dir $(GITWEB_MODULES))) && \
echo $$install_dirsperhaps?
Hint: dq.
Quoted 23 lines · Junio C Hamano
Quoted 11 lines · Jakub Narebski
Quoted 3 lines
gitweb/Makefile gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS · line 156
Quoted 3 lines
gitweb/Makefile +2
-0+install-modules: + install_dirs=$(sort $(dir $(GITWEB_MODULES))) && \For example with the following
Makefile:
GITWEB_MODULES+= GitwebCache/SimpleFileCache.pmGITWEB_MODULES+= GitwebCache/Capture.pmGITWEB_MODULES+= GitwebCache/Capture/SelectFH.pmGITWEB_MODULES+= Gitweb/Config.pmQuoted 6 lines
all: @echo $(sort $(dir $(GITWEB_MODULES)))running 'make' results in:
Gitweb/ GitwebCache/ GitwebCache/Capture/
Try replacing that with:
Quoted 7 lines
all: install_dirs=$(sort $(dir $(GITWEB_MODULES))) && \ echo $$install_dirsperhaps?
Hint: dq.
You are completely right. I'm sorry. I should have copied the structure from "[PATCH 2/2 v2] Makefile: work around ksh's failure to handle missing list argument to for loop" more carefully.
I'll resend it.
Signature · 2 lines
Jakub Narebski Poland
Prepare gitweb for having been split into modules that are to be installed alongside gitweb in 'lib/' subdirectory, by adding
use lib __DIR__.'/lib';
to gitweb.perl (to main gitweb script), and preparing for putting modules (relative path) in $(GITWEB_MODULES) in gitweb/Makefile.
---
Differences from v2:
* Fixed issue with quoting value of shell variable, pointed by Junio
* Removed spurious unrelated addition of an empty line, pointed by Ævar
gitweb/Makefile | 14 +++++++++++++- gitweb/gitweb.perl | 8 ++++++++ 2 files changed, 21 insertions(+), 1 deletions(-)
gitweb/Makefile +13 -1
@@ -55,6 +55,7 @@ PERL_PATH ?= /usr/bin/perl bindir_SQ = $(subst ','\'',$(bindir))#' gitwebdir_SQ = $(subst ','\'',$(gitwebdir))#' gitwebstaticdir_SQ = $(subst ','\'',$(gitwebdir)/static)#' +gitweblibdir_SQ = $(subst ','\'',$(gitwebdir)/lib)#' SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))#' PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))#' DESTDIR_SQ = $(subst ','\'',$(DESTDIR))#'
@@ -145,12 +146,23 @@ gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS ### Installation rules -install: all +install: all install-modules $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebdir_SQ)' $(INSTALL) -m 755 $(GITWEB_PROGRAMS) '$(DESTDIR_SQ)$(gitwebdir_SQ)' $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)' $(INSTALL) -m 644 $(GITWEB_FILES) '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)' +install-modules: + install_dirs="$(sort $(dir $(GITWEB_MODULES)))" && \ + for dir in $$install_dirs; do \ + test -d '$(DESTDIR_SQ)$(gitwebdir_SQ)/$$dir' || \ + $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebdir_SQ)/$$dir'; \ + done + gitweb_modules="$(GITWEB_MODULES)" && \ + for mod in $$gitweb_modules; do \ + $(INSTALL) -m 644 $$mod '$(DESTDIR_SQ)$(gitwebdir_SQ)/$$(dirname $$mod)'; \ + done + ### Cleaning rules clean:
gitweb/gitweb.perl +8 -0
@@ -9,6 +9,14 @@ use strict; use warnings; + +use File::Spec; +# __DIR__ is taken from Dir::Self __DIR__ fragment +sub __DIR__ () { + File::Spec->rel2abs(join '', (File::Spec->splitpath(__FILE__))[0, 1]); +} +use lib __DIR__ . '/lib'; + use CGI qw(:standard :escapeHTML -nosticky); use CGI::Util qw(unescape); use CGI::Carp qw(fatalsToBrowser set_message);
Signature · 1 line
1.7.0.1
gitweb/gitweb.perl line 19
Quoted 11 lines · Jakub Narebski
[...]
use strict;
use warnings;gitweb/gitweb.perl +8
-0+ +use File::Spec; +# __DIR__ is taken from Dir::Self __DIR__ fragment +sub __DIR__ () { + File::Spec->rel2abs(join '', (File::Spec->splitpath(__FILE__))[0, 1]); +} +use lib __DIR__ . '/lib'; +
What was the result of the discussion about using __DIR__ again? You only need to use that method when you call a perl program whith *then* includes a module. If you just need to add the lib/ directory relative to the script you're invoking you can use FindBin:
use FindBin qw($Bin);
use lib "$Bin/lib";gitweb/gitweb.perl use Encode; · line 28
Quoted 9 lines
use CGI qw(:standard :escapeHTML -nosticky);
useCGI::Utilqw(unescape);
useCGI::Carpqw(fatalsToBrowser set_message);gitweb/gitweb.perl +1
-0@@ -16,6 +24,7 @@ use Encode; use Fcntl ':mode'; use File::Find qw(); use File::Basename qw(basename); + binmode STDOUT, ':utf8';
The whitespace change distracts from the real patch a bit.
Quoted 18 lines · Ævar Arnfjörð Bjarmason
gitweb/gitweb.perl line 19
Quoted 11 lines · Jakub Narebski
[...]
use strict;
use warnings;gitweb/gitweb.perl +8
-0+ +use File::Spec; +# __DIR__ is taken from Dir::Self __DIR__ fragment +sub __DIR__ () { + File::Spec->rel2abs(join '', (File::Spec->splitpath(__FILE__))[0, 1]); +} +use lib __DIR__ . '/lib'; +What was the result of the discussion about using
__DIR__again? You only need to use that method when you call a perl program whith *then* includes a module. If you just need to add thelib/directory relative to the script you're invoking you can use FindBin:
Quoted 2 lines
use FindBin qw($Bin);
use lib "$Bin/lib";It's
use lib "$Bin/../lib";
(I don't like this ../lib here, but that's my personal preference).
But you might be right that I am overly cautious in avoiding FindBin. It is nowadays not recommended solution (on #perl, for example), but it is perhaps true that the conditions where it fails are not fulfilled for the case of gitweb.
Or perhaps not:
KNOWN ISSUES
If there are two modules using FindBin from different directories under the same interpreter, this won't work. Since FindBin uses a BEGIN block, it'll be executed only once, and only the first caller will get it right. This is a problem under **mod_perl** and other persistent Perl environments, where you shouldn't use this module.
Gitweb can be used under mod_perl (to be more exact ModPerl::Registry).
Quoted 11 lines
gitweb/gitweb.perl use Encode; · line 28
Quoted 9 lines
use CGI qw(:standard :escapeHTML -nosticky);
useCGI::Utilqw(unescape);
useCGI::Carpqw(fatalsToBrowser set_message);gitweb/gitweb.perl +1
-0@@ -16,6 +24,7 @@ use Encode; use Fcntl ':mode'; use File::Find qw(); use File::Basename qw(basename); + binmode STDOUT, ':utf8';The whitespace change distracts from the real patch a bit.
Ooops, I'm sorry.
I'll fix it in resend, if required.
Signature · 2 lines
Jakub Narebski Poland
Quoted 37 lines · Jakub Narebski
Quoted 18 lines · Ævar Arnfjörð Bjarmason
gitweb/gitweb.perl line 19
Quoted 11 lines · Jakub Narebski
[...]
use strict;
use warnings;gitweb/gitweb.perl +8
-0+ +use File::Spec; +# __DIR__ is taken from Dir::Self __DIR__ fragment +sub __DIR__ () { + File::Spec->rel2abs(join '', (File::Spec->splitpath(__FILE__))[0, 1]); +} +use lib __DIR__ . '/lib'; +What was the result of the discussion about using
__DIR__again? You only need to use that method when you call a perl program whith *then* includes a module. If you just need to add thelib/directory relative to the script you're invoking you can use FindBin:Quoted 2 lines
use FindBin qw($Bin); use lib "$Bin/lib";It's
use lib "$Bin/../lib";(I don't like this ../lib here, but that's my personal preference).
But you might be right that I am overly cautious in avoiding FindBin. It is nowadays not recommended solution (on #perl, for example), but it is perhaps true that the conditions where it fails are not fulfilled for the case of gitweb.
Or perhaps not:
KNOWN ISSUES
Quoted 7 lines
If there are two modules using FindBin from different directories under the same interpreter, this won't work. Since FindBin uses a BEGIN block, it'll be executed only once, and only the first caller will get it right. This is a problem under **mod_perl** and other persistent Perl environments, where you shouldn't use this module.
Gitweb can be used under
mod_perl(to be more exactModPerl::Registry).
And there is also nowadays 'plackup' option for git-instaweb, which also would have, I think, this problem with FindBin.
Signature · 2 lines
Jakub Narebski Poland
Quoted 19 lines · Jakub Narebski
Quoted 18 lines · Ævar Arnfjörð Bjarmason
gitweb/gitweb.perl line 19
Quoted 11 lines · Jakub Narebski
[...]
use strict;
use warnings;gitweb/gitweb.perl +8
-0+ +use File::Spec; +# __DIR__ is taken from Dir::Self __DIR__ fragment +sub __DIR__ () { + File::Spec->rel2abs(join '', (File::Spec->splitpath(__FILE__))[0, 1]); +} +use lib __DIR__ . '/lib'; +What was the result of the discussion about using
__DIR__again? You only need to use that method when you call a perl program whith *then* includes a module. If you just need to add thelib/directory relative to the script you're invoking you can use FindBin:
Quoted 8 lines
Quoted 2 lines
use FindBin qw($Bin); use lib "$Bin/lib";It's
use lib "$Bin/../lib";(I don't like this ../lib here, but that's my personal preference).
Actually for gitweb, where gitweb.cgi is put in "top" directory, and lib/ directory is in the same directory that the script is, it would be
use FindBin qw($Bin);
use lib "$Bin/lib";The documentation says that $FindBin::Bin is
$Bin - path to bin directory from where script was invoked
so it is path to directory, not to script itself.
If it worked...
Quoted 9 lines
But you might be right that I am overly cautious in avoiding FindBin. It is nowadays not recommended solution (on #perl, for example), but it is perhaps true that the conditions where it fails are not fulfilled for the case of gitweb.
Or perhaps not:
KNOWN ISSUES
Quoted 7 lines
If there are two modules using FindBin from different directories under the same interpreter, this won't work. Since FindBin uses a BEGIN block, it'll be executed only once, and only the first caller will get it right. This is a problem under **mod_perl** and other persistent Perl environments, where you shouldn't use this module.
Gitweb can be used under
mod_perl(to be more exactModPerl::Registry).
I wrote simple script that tests result of __DIR__ and $FindBin::Bin. For cgi-bin / mod_cgi it was:
__DIR__ = /var/www/cgi-bin/gitweb (symlink to /home/local/gitweb)
$FindBin::Bin = /home/local/gitweb
For mod_perl (ModPerl::Registry handler) it was
__DIR__ = /var/www/perl/gitweb (symlink to /home/local/gitweb)
$FindBin::Bin = /
As you can see it's useless. I have't checked the FastCGI case...
Signature · 2 lines
Jakub Narebski Poland
Quoted 6 lines · Jakub Narebski
I wrote simple script that tests result of
__DIR__and $FindBin::Bin. For cgi-bin /mod_cgiit was:__DIR__ =
/var/www/cgi-bin/gitweb(symlink to/home/local/gitweb) $FindBin::Bin =/home/local/gitweb
Quoted 6 lines
For
mod_perl(ModPerl::Registryhandler) it was__DIR__ =
/var/www/perl/gitweb(symlink to/home/local/gitweb) $FindBin::Bin = /As you can see it's useless. I have't checked the FastCGI case...
Thanks for spending time researching what was an offhand ignorant "hey wasn't .." comment. Also, sorry :)
But that's very informative. Good to know that FindBin is broken like that under mod_perl.
Quoted 10 lines · Ævar Arnfjörð Bjarmason
Quoted 8 lines · Jakub Narebski
I wrote simple script that tests result of
__DIR__and $FindBin::Bin. For cgi-bin /mod_cgiit was:__DIR__ =
/var/www/cgi-bin/gitweb(symlink to/home/local/gitweb) $FindBin::Bin =/home/local/gitwebFor
mod_perl(ModPerl::Registryhandler) it was
Quoted 7 lines
Quoted 4 lines
__DIR__ =
/var/www/perl/gitweb(symlink to/home/local/gitweb) $FindBin::Bin = /As you can see it's useless. I have't checked the FastCGI case...
Thanks for spending time researching what was an offhand ignorant "hey wasn't .." comment. Also, sorry :)
Nothing to it. I wanted to check if there really is a problem with FindBin on mod_perl, as I was not sure with description in "Known Issues" section in FindBin manpage.
Note that using 'FindBin->again();' after 'use FindBin;' fixes this issue. So perhaps it would be beter to use FindBin than borrow code for __DIR__ from Dir::Self.
Quoted 2 lines
But that's very informative. Good to know that FindBin is broken like that under
mod_perl.
It might be only under ModPerl::Registry, but it might be not.
Signature · 2 lines
Jakub Narebski Poland
Quoted 19 lines · Jakub Narebski
Quoted 10 lines · Ævar Arnfjörð Bjarmason
Quoted 8 lines · Jakub Narebski
I wrote simple script that tests result of
__DIR__and $FindBin::Bin. For cgi-bin /mod_cgiit was:__DIR__ =
/var/www/cgi-bin/gitweb(symlink to/home/local/gitweb) $FindBin::Bin =/home/local/gitwebFor
mod_perl(ModPerl::Registryhandler) it wasQuoted 7 lines
Quoted 4 lines
__DIR__ =
/var/www/perl/gitweb(symlink to/home/local/gitweb) $FindBin::Bin = /As you can see it's useless. I have't checked the FastCGI case...
Thanks for spending time researching what was an offhand ignorant "hey wasn't .." comment. Also, sorry :)
Quoted 7 lines
Nothing to it. I wanted to check if there really is a problem with FindBin on
mod_perl, as I was not sure with description in "Known Issues" section in FindBin manpage.Note that using '
FindBin->again();' after 'use FindBin;' fixes this issue. So perhaps it would be beter to use FindBin than borrow code for__DIR__fromDir::Self.
That should work, though note that FindBin->again requires at least perl 5.8.3. This should work on older versions (if Gitweb cares):
if ($] <= 5.008003) {
delete $INC{'FindBin.pm'};
require FindBin;
} else {
FindBin->again;
}See https://rt.cpan.org/Public/Bug/Display.html?id=57988 and
http://search.cpan.org/diff?from=Module-Install-0.98&to=Module-Install-0.99
for reference.
Quoted 38 lines · Ævar Arnfjörð Bjarmason
Quoted 19 lines · Jakub Narebski
Quoted 10 lines · Ævar Arnfjörð Bjarmason
Quoted 8 lines · Jakub Narebski
I wrote simple script that tests result of
__DIR__and $FindBin::Bin. For cgi-bin /mod_cgiit was:__DIR__ =
/var/www/cgi-bin/gitweb(symlink to/home/local/gitweb) $FindBin::Bin =/home/local/gitwebFor
mod_perl(ModPerl::Registryhandler) it wasQuoted 7 lines
Quoted 4 lines
__DIR__ =
/var/www/perl/gitweb(symlink to/home/local/gitweb) $FindBin::Bin = /As you can see it's useless. I have't checked the FastCGI case...
Thanks for spending time researching what was an offhand ignorant "hey wasn't .." comment. Also, sorry :)
Quoted 7 lines
Nothing to it. I wanted to check if there really is a problem with FindBin on
mod_perl, as I was not sure with description in "Known Issues" section in FindBin manpage.Note that using '
FindBin->again();' after 'use FindBin;' fixes this issue. So perhaps it would be beter to use FindBin than borrow code for__DIR__fromDir::Self.That should work, though note that
FindBin->againrequires at least perl 5.8.3. This should work on older versions (if Gitweb cares):if ($] <= 5.008003) { delete $INC{'FindBin.pm'}; require FindBin; } else { FindBin->again; }
Quoted 3 lines
See https://rt.cpan.org/Public/Bug/Display.html?id=57988 and
http://search.cpan.org/diff?from=Module-Install-0.98&to=Module-Install-0.99
for reference.
Thanks for research.
I don't think gitweb cares, as it requires Perl with sane Unicode support, which means at least Perl 5.8.0 (for Encode module), but I think it really means at least 5.8.3
Signature · 2 lines
Jakub Narebski Poland