in reply to flock, not unflocking

Well, if your program doesn't release the lock by itself, just make sure your filehandle is unlocked by yourself..:
END { flock (FILEHANDLE, 8); #or, more general: #flock (FILEHANDLE, LOCK_UN); }

Regards,
octopus
--
GED/CC d-- s:- a--- C++(+++) UL+++ P++++$ L++>++++ E--- W+++@ N o? K? w-- O- M-(+) V? !PS !PE !Y PGP+(++) t-- 5 X+ R+(+++) tv+(++) b++@ DI+() D+ G++ e->+++ h!++ r+(++) y+

Replies are listed 'Best First'.
Re: Re: flock, not unflocking
by KM (Priest) on Feb 15, 2001 at 18:52 UTC
    #or, more general:
    #flock (FILEHANDLE, LOCK_UN);

    That isn't 'more general', that is the 'correct way'. These constants shouldn't be hard coded. Use the Fcntl module to import your systems constants.

    Cheers,
    KM

Re: Re: flock, not unflocking
by extremely (Priest) on Feb 15, 2001 at 20:23 UTC
    Actually, I think it is better to do a close FILEHANDLE; and let perl drop the flock as a part of that close. If you unlock a file and then wait to close, something else could potentially sneak in there at a "bad" time. It isn't supposed to happen but "isn't supposed" is what you are trying to preven with flocking to begin with...

    --
    $you = new YOU;
    honk() if $you->love(perl)