On Tue, Jun 13, 2006 at 11:31:01AM +0200, Florian Weimer wrote: > I'm trying to implement an encryption layer using PerlIO (in C, not > using PerlIO::via). Is it correct that I shouldn't provide yet another > line discipline like PerlIO::encoding, but a completely new lowest layer (like > the "unix" layer) which happens to use another file handle in its > implementation? After all, the encryption layer is completely opaque as > far as line translation, buffering etc. are concerned, and there doesn't > seem to be a more direct way to encode this in the PerlIO abstraction.
To me it seems more logical to provide a layer that takes data from the layer below, rather than re-implementing all the logical to open files close files/maintain file handle state. PerlIO::gzip doesn't worry about line translation (but because of zlib does need some sort of input buffer) and it is implemented as a transformation layer akin to PerlIO::encoding, rather than a lowest layer akin to "unix". Nicholas Clark