Re: [RFC PATCH 01/10] gitweb: Print to explicit filehandle (preparing for caching)
- From
Jakub Narebski <jnareb@gmail.com>
- Date
- Feb 7, 2010, 21:32 UTC
- Message-ID
- <201002072232.07378.jnareb@gmail.com>
- In-Reply-To
- <0dd15cb3f18e2a26fc834fd3b071e6d3ecc00557.1264198194.git.jnareb@gmail.com>
On Sat, 23 Feb 2010, Jakub Narebski wrote:
Show 11 quoted lines
> 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