On Sunday, Nov 16, 2003, at 10:41 US/Pacific, Jeff 'japhy' Pinyan wrote: [..]
And yes, DO remember the caveat at the end of the select
perldoc that notes:

             WARNING: One should not attempt to mix buffered I/O
             (like "read" or <FH>) with "select", except as
             permitted by POSIX, and even then only on POSIX
             systems.  You have to use "sysread" instead.

That's out of context; that warning is for the multi-arg for of select().

yes and no.


yes, in the sense that it comes in the section about

select RBITS,WBITS,EBITS,TIMEOUT

and as long as the person stays safely with the 'simpler'
perl select, and does not wander off into having buffered
and unbuffered file handles, then clearly it is "out of context".

But I would also argue 'no' in that the moment that one
wanders into 'needing' to use "select", it is really not
that long a walk off a very short pier till one has to
remember the differences between buffered and unbuffered I/O.
At which point remembering the caveat is worth it,
whether or not one has actually stepped into the fullness
of the 'multi-arg' form of select.

For me, it has been years since i have used perl's 'write',
yet I have watched "RealCoders[tm]" - 'hurt themselves', myself
included - because what started out as 'just some script' -
and were running with the 'print' statements going to the
default file handle... only to step on the default with
a select statement, for a filehandle we were using with
sysread and NOT doing the polite thing and restoring the
default file handle.

So my intention was to finish off the general discussion
of 'do you really need select' with that simple reminder
that when one does need select, one also needs to do some
basic defensive coding one place or the other. Since for
'RealCoders[tm]' coming to perl it is easier to slip into
'perl coding' without thinking, because they have access
to POSIX, et al, and most of the time the DWIM is correct,
then they run into an 'ooopsie' moment. While those who arrive
at Perl from a 'scripting' background can wander off into sysread()
without any of the 'RealCoders[tm]' well defined notions of 'best practice';
to honor in the breach...


So why not underscore the "we have good news and we have information...."

ciao
drieux

---


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to