in reply to Re^2: File Locking revisited
in thread File Locking revisited

I was worried someone would say that

What's to worry about? If you're concerned about having to keep an extra file around, consider locking the script itself. This may not be appropriate in all cases, but it's a fairly common idiom:

use Fcntl qw(:flock); # lock myself open my $lockfh, "<", $0 or die "Cannot lock myself: $!\n"; flock $lockfh, LOCK_EX; # ... close $lockfh;

Replies are listed 'Best First'.
Re^4: File Locking revisited
by Jasper (Chaplain) on Dec 03, 2004 at 16:04 UTC
    Yes, I've done this before, but it's not appropriate here. We're doing distributed processing on hundreds of pairs of files coming from one source. In the process, a certain amount of wheel reinvention has occurred, I'm sure.