Well, based on looking at the man page for IO::File, I'd
say that what it does is to control whether the
file handle involved will perform "blocking i/o" or
"non-blocking i/o". Are you looking for an explanation
about what this means? If so, you could start by looking at
Tk::fileevent...
...
Event-driven I/O works best for filehandles that have been
placed into nonblocking mode. In blocking mode, a "print"
command may block if you give it more data than the under
lying file or device can accept, and a "<>", "sysread" or
"read" command will block if you attempt to read more data
than is ready; no events will be processed while the com
mands block. In nonblocking mode "print", "<>", "sysread"
and "read" never block. See the documentation for the
individual commands for information on how they handle
blocking and nonblocking filehandles.
Non-blocking i/o is totally cool for those situations when
it really matters, like "I don't know when that %^&#!! user
is gonna hit a key, but as soon as he does, BOY am I
gonna whack him!"
update: (A less vindictive application would be
a case like a server that may be accepting connections
and input data from any number of clients. Once it has
one or more clients connected, it merely wants to try to
read from each one, and if there's something to read,
handle that; otherwise, don't just hang, waiting on a lagging client
-- move on! See if there's another connection request, look
for input from other clients, keep busy!) | [reply] [d/l] |
| [reply] |
In case you haven't done a super-search for "flock", you
can check this thread, which has relevant info in
some of the later replies, as well as a link to a useful
article from the Feb.2002 Perl Journal (Issue #23).
In short, flock is not available on Windows 9x systems, but
is available on NT, XP, 2000. However, the TPJ article
contains some code that you can use to create semaphore
files, which can serve to accomplish the same thing as
flock.
| [reply] |