On Wed, Jul 20, 2011 at 11:58 PM, Eric Brine <ikegami@adaelis.com> wrote: > I started writing one pure Perl version (using PerlIO::via) a while back. > Should be easy right? ha! > > It lead to improvements to Unicode::Normalize (addition of > C<normalize_partial> and some doc improvements), but I stalled when I found > that PerlIO::via didn't provide access to a crucial facility available to XS > PerlIO layers. Specifically, PerlIO::via doesn't provide the ability to peek > into the buffer of the previous layer. IIRC, without that facility, > PerlIO::via layers cannot process input as it comes in and must wait for > EOF. I never got around to adding the functionality to PerlIO::via. > > I'll dig up what I have tonight. What it really needs is not so much a peek ability, but a read-and-give-up ability. Currently in PerlIO, when you try to PerlIO_read X bytes, it will loop reading until you have X bytes/characters, instead of returning what it has an letting the rest be. Peeking into the buffer is currently the only way to implement the latter, but it shouldn't be IMHO. LeonThread Previous | Thread Next