Thread (1 message) 1 message, 1 author, 2016-06-15

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

From: Jakub Narebski <hidden>
Date: 2016-06-15 22:48:12

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help