Subject: Re: [RFC PATCH 01/10] gitweb: Print to explicit filehandle (preparing for caching)

From: Jakub Narebski <[email-masked]>
Date: Sun, 7 Feb 2010 22:32:06 +0100

On Sat, 23 Feb 2010, Jakub Narebski wrote:

> This means replacing
> 
>   print <something>;
> by
>   print {$out} <something>;
> 
> and
> 
>   binmode STDOUT, <layer>;
> by
>   binmode $out, <layer>;

[...]

> This patch was written _before_ comment from Junio that it would be
> better to simply use
>   print $out <something>;
> and do not try to be too clever.

Actually 'print FILEHANDLE LIST' form is an example of indirect object
syntax in Perl (which for filehandles was present before there were
objects in Perl).  In indirect object notation the "first argument"
must be a name, a scalar variable, or a block (like {$out}).  If instead
of $out there would be something more complicated, we would have to
use block form ('print {$out[$i]} <sth>', for example).

-- 
Jakub Narebski
Poland