Re: [PATCHv7.1 3/4] gitweb: File based caching layer (from git.kernel.org)
- From
- demerphq <demerphq@gmail.com>
- Date
- Nov 29, 2010, 23:26 UTC
- Message-ID
- <AANLkTim5V_50Er8OiNTWDHNzvqJ3J+biOwuqnBdnR4jH@mail.gmail.com>
- In-Reply-To
- <AANLkTinX9Phu+SuOyEWtAsMz182VkfVkJva1ep==V-zQ@mail.gmail.com>
On 30 November 2010 00:07, demerphq <demerphq@gmail.com> wrote:
Show 22 quoted lines
> 2010/11/13 Jakub Narebski <jnareb@gmail.com>:
>> - binmode STDOUT, ':raw';
>> - print <$fd>;
>> - binmode STDOUT, ':utf8'; # as set at the beginning of gitweb.cgi
>> + if ($caching_enabled) {
>> + open BINOUT, '>', $fullhashbinpath or die_error(500, "Could not open bin dump file");
>> + }else{
>> + open BINOUT, '>', \$fullhashbinpath or die_error(500, "Could not open bin dump file");
>> + }
>> + binmode BINOUT, ':raw';
>> + print BINOUT <$fd>;
>> + binmode BINOUT, ':utf8'; # as set at the beginning of gitweb.cgi
>> + close BINOUT;
>
> Why do you use dynamically scoped file handles here as opposed to
> lexically scoped ones?
>
> And why do you change the output discipline on BINOUT immediately
> before closing the file, and after you print data to it?
>
> Doing so sortof makes sense when the filedhandle is STDOUT, but not
> when it is BINOUT.Also in this code:
2010/11/28 Jakub Narebski <jnareb@gmail.com>:
Show 8 quoted lines
> +#
> +# Includes
> +#
> +if (!exists $INC{'cache.pl'}) {
> + my $return = do 'cache.pl';
> + die $@ if $@;
> + die "Couldn't read 'cache.pl': $!" if (!defined $return);
> +}Why is that preferred to:
require 'cache.pl';
And why is this thing even a .pl file? Why isnt it called lib/GitWeb/Cache.pm or something like that?
-- perl -Mre=debug -e "/just|another|perl|hacker/"