On Thu, Oct 12, 2000 at 10:29:14PM +0100, Simon Cozens wrote:
> On Thu, Oct 12, 2000 at 10:14:03PM +0100, Nicholas Clark wrote:
> > Not to violate KISS. Only because Simon's RFC based on Benjamin's analysis
> > said we'd need to.
>
> I find the idea of having various layers which have various functions to
> be extremely simple.
>
> I really would not like to write code which attempted to preside over a
> free-for-all of disciplines.
I think I'm coming round to agreeing with you from the perl side of things.
But I can't reconcile it with the following:
I've got the 4 line (84 bytes) file:
begin 664 flack
M4'5G:`I0=6=H"D)A<FYE>2!-8T=R97<*0W5T:&)E<G0*1&EB8FQE"D=R=6(*
`
end
and my program is roughly
$_ = <FH>;
if (/^begin \d\d\d ./) {
binmode FH, ":uudecode";
$_ = <FH>;
}
while (defined $_) {
...
$_ = <FH>;
}
then if I understand rfc311 initially the discipline stack on FH is
0 (OS) 1 (Byte) 2 (to UTF) 3 (on UTF) 4 (records)
OS_interface Latin1->UTF $/ splitter
for this example my $/ splitter has a buffer size of 32 bytes.
before I read the first line, all buffers are empty.
Read first line, $/ splitter requests 32 bytes down the chain, and gets back
"begin 664 flack\nM4'5G:`I0=6=H\"D)"
so it returns "begin 664 flack\n" and has "M4'5G:`I0=6=H\"D)" remaining it its
buffer. OS level file pointer now at byte 32, perl pointer at 16
(**characters** no-one has said that yet!), 16 bytes (characters?) in
transit through the pipeline
At this point it pushes uudecode discipline on, which is a Byte transformer.
1: Does the act of pushing trigger the $/ splitter to push back
"M4'5G:`I0=6=H\"D)" all the way to level 0.5 (ie beyond OS_interface,
before Byte)?
2: Does the act of pushing trigger a seek to position 16 discarding buffered
data?
3,4: Or does it flag this the next read on the handle to trigger either 1 or 2
(lazy version)?
because "do the right thing" is obvious at the perl level.
I don't want the next read to return a line starting "M4'5G:`I0=6=H\"D)" -
I want the uudecoded version (5 characters, "Pugh\n"). It's easy to say, I just
can't see how to implement it in C without leaking data.
Nicholas Clark