Re: [PATCH] gitweb: Support caching projects list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



  Hi,

On Fri, Mar 14, 2008 at 05:14:51AM -0700, Jakub Narebski wrote:
> Petr Baudis <pasky@xxxxxxx> writes:
> [...]
> > +	if ($cache_lifetime and -f $cache_file
> > +	    and stat($cache_file)->mtime + $cache_lifetime * 60 > time()
> > +	    and open (my $fd, $cache_file)) {
> > +		$stale = time() - stat($cache_file)->mtime;
> > +		my @dump = <$fd>;
> > +		close $fd;
> > +		# Hack zone start
> > +		my $VAR1;
> > +		eval join("\n", @dump);
> > +		@projects = @$VAR1;
> > +		# Hack zone end
> 
> Why do you read line by line, only to join it, i.e.
>   my @dump = <$fd>; ... join("\n", @dump);
> instead of slurping all file in one go:
>   local $/ = undef; my $dump = <$fd>; ... $dump;
> 
> Besides, why do you use Data::Dumper instead of Storable? Both are
> distributed with Perl; well, at least both are in perl-5.8.6-24.

  no particular reason - I simply never heard about Storable. I learned
Perl too long ago it seems. ;-)

> [...]
> > -	git_project_list_body(\@list, $order);
> > +	git_project_list_body(\@list, $order, undef, undef, undef, undef, $projlist_cache_lifetime);
> 
> This is ugly. Why not use hash for "named parameters", as it is done
> in a few separate places in gitweb (search for '%opts')?

  I agree - I was simply too lazy to make another patch. :-)

-- 
				Petr "Pasky" Baudis
Whatever you can do, or dream you can, begin it.
Boldness has genius, power, and magic in it.	-- J. W. von Goethe
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux