Re: [RFC PATCHv2 04/10] gitweb: Use Cache::Cache compatibile (get, set) output caching

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

 



Dnia środa 10. lutego 2010 19:22, Jakub Narebski napisał:

> Well, the idea was to use PerlIO::Util if possible, checking it via
> 
>   out $use_perlio_layers = eval { require PerlIO::Util; 1 };
> 
> and fallback to generic mechanism if it is not present.  Only the
> generic mechanism would have to be changed from manipulating *STDOUT
> (*STDOUT = $data_fh etc.) to tied filehandle.

Well, damn, this is not needed[1].  Instead of manipulating *STDOUT,
it is enough to use 'select FILEHANDLE'.  It means that the capture
would look like this:

  open my $data_fh, '>', \$data;
  my $oldfh = select($data_fh);

  # ... code that uses 'print <sth>'

  select($oldfh);
  close $data_fh;

One thing that needs to be done is changing 'binmode STDOUT ...' into
'binmode select() ...'

[1] Thanks to mst on #perl channel for pointing this to me.
-- 
Jakub Narebski
Poland
--
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]