[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Anyone...?



I thought that was it, but Thomas Kimpton's point about \015\012 is also
very important.  Almost all Internet protocols use \015\012 as the end of
line, and most servers simply don't respond at all unless the end of line
is correct.
-
Indeed- but in my personal scripts, I've done that pretty much since the
beginning. Don't know why that didn't show up here- I think I pasted in the
changes and forgot to add that in the mailing.
-
}
}-Seraph
}
}PS- that just make the input unbuffered, right?

No, it doesn't do anything to the input.  Notice that there's a little
unprintable character box at the beginning of every line after the first
that comes out of a socket?  That's the \012 from the end of the previous
line. The lines are fed to you line by line with <> as requested.  MacPerl
thinks a line ends with \015, so it keeps the \012 in the buffer and gives
it to you with the next line.  With this kind of simple socket reading, you
run the risk that nothing is there when you read, but it usually works just
fine.  More sophisticated examples that you can find in your MacPerl lib
folder or on CPAN will use the four argument select to see if something is
actually available on the input before reading.
-
I see... but then why did I get that when I made the line delimiter /015/012 ?
-
What $| (also know as $OUTPUT_AUTOFLUSH when you "use English") is
"unbuffer" the output (technically, it doesn't unbuffer but "command
buffer" the output).  That means that each line is sent as soon as the
print is executed, rather than the usual being stored up in a buffer to be
sent as a block when the buffer is full.
-
Ahh... I see. That makes it much clearer. Thanks.

-Seraph



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch