The jaws that bite, the claws that catch!
Today's Perl Advent calendar talks about file locking, which is always mimsy. To continue the gift wrapping metaphor...that all works fine when you're wrapping gifts in the bedroom, but what happens when you decide to use the laundry room instead? That room has a Dutch door on it. Are you sure you locked everything correctly?
Oops!
In this metaphor, the bedroom is mounted locally, but the laundry room is mounted via NFS. Your locking scheme might work, but it might not. There are different kinds of Dutch doors with various latches and locks.
I've had good luck with File::NFSLock, which uses linking rather than flock. A common use case is creating a cron job that can only run one instance at a time.
Recent Comments