On Wed, Aug 06, 2003 at 07:55:59PM -0700, $Bill Luebkert wrote:
> Mark Mielke wrote:
> > That said, I'm the paranoid type, and I always choose to flock(LOCK_UN)
> > my file handes from Perl.
> That could be a mistake if the last write is still cached in memory and
> hasn't been written out yet.  Stick with just the close.  Having said that,
> the manpage now says:
>             "To avoid the possibility of miscoordination, Perl now flushes
>             FILEHANDLE before locking or unlocking it."
> So it might be OK to do the unlock anyway on later versions of Perl.

Back when flock() didn't fflush() the buffer, use of $|=1 was strongly
recommended. Most people considered flock() to be broken at that time,
which is why the patch to fix it was accepted. For those curious, perl
5.003_94 was the revision that began to fflush() on flock().

Of course, being the paranoid type, I've been known to use syswrite()
instead of write() or print() when using flock()... :-)

mark

-- 
[EMAIL PROTECTED]/[EMAIL PROTECTED]/[EMAIL PROTECTED] __________________________
.  .  _  ._  . .   .__    .  . ._. .__ .   . . .__  | Neighbourhood Coder
|\/| |_| |_| |/    |_     |\/|  |  |_  |   |/  |_   | 
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, Ontario, Canada

  One ring to rule them all, one ring to find them, one ring to bring them all
                       and in the darkness bind them...

                           http://mark.mielke.cc/

_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to