develooper Front page | perl.perl5.porters | Postings from May 2013

[perl #57288] PerlIO::via::QuotedPrint not flushing

James E Keenan via RT
May 26, 2013 17:10
[perl #57288] PerlIO::via::QuotedPrint not flushing
Message ID:
On Fri Jul 25 17:52:12 2008, kryde wrote:
> When a PerlIO::via::QuotedPrint layer is pushed on an opened file,
> autoflush or an explicit ->flush() doesn't send output to the file
> immediately.
> The program below shows the problem.  I hoped the OUT->flush
>    would
> make the "hello" appear in /tmp/foo immediately, but that doesn't
> happen, not until after the program exits after the sleep.
> I guess QuotedPrint doesn't supply a FLUSH routine, and the default
>    for
> PerlIO::via in that case is to do nothing, so a top-level flush
>    doesn't
> reach the :perlio+:unix full-buffered output layer below.
> Several other PerlIO::via output modules on cpan behave the same,
> I guess having used QuotedPrint as a model.  I wonder if either
> - The PerlIO::via docs could advise every output layer to supply a
>    FLUSH
>   function calling $fh->flush on the sublayer.
> - PerlIO::via could make such a "propagated" flush the default if you
>   don't supply a FLUSH routine.
> The latter could make life easier for straightforward non-buffering
> transformer layers.  The only question would be whether anyone has
> omitted a FLUSH func deliberately wanting not to call flush on the
> sublayer.  That'd seem a bit unlikely to me, or only applicable to
> something that was designed to be at the bottom of the stack anyway
> (an output capture of some sort say) ...

This is one of three PerlIO-related tickets filed by the same user
several years ago.  Is there anyone on list who could take a look at them?

Thank you very much.
Jim Keenan

via perlbug:  queue: perl5 status: new Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About