develooper Front page | perl.perl5.porters | Postings from March 2016

[perl #127805] Let windows Perl programs call setvbuf on filehandles

From:
Yary
Date:
March 31, 2016 13:48
Subject:
[perl #127805] Let windows Perl programs call setvbuf on filehandles
Message ID:
rt-4.0.18-3925-1459386016-552.127805-75-0@perl.org
# New Ticket Created by  Yary 
# Please include the string:  [perl #127805]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=127805 >


An infrequently asked Perl5 question is how to adjust the read-ahead buffer for normal reads. Example discussions on the web include

http://stackoverflow.com/questions/1251062/how-can-i-set-the-file-read-buffer-size-in-perl-to-optimize-it-for-large-files

http://perlmonks.org/?node_id=692348 "4k read buffer is too small"

The best-documented answer these days is setvbuf as mentioned in the IO::Handle docs. However: "IO::Handle::setvbuf() is not available by default on Perls 5.8.0 and later" and indeed that's the case- it doesn't seem to be available on my Strawberry Perl 5.22, even if I open a handle with the ":stdio" layer.

Being able to adjust a filehandle's read-ahead buffer size is occasionally useful for some unusual scenarios. -> It would be great to provide a way to set the buffer size in IO::Handle with current Perl.

even if it isn't feasible to implement this feature request, there is now a layer module on CPAN that provides this- PerlIO::buffersize - perhaps that module could be mentioned alongside "setbuf" in the IO::Handle docs as an alternative.




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About