I think what you may want to do is use a semaphore file -- that is, a separate file (which can remain empty) to which you apply flock. Competing processes use the same semaphore file to serialize the use of any shared resource. Each process tries to get a lock on the semaphore, and once it has the lock, it does whatever it needs to do with the shared resource (e.g. move or alter some other data file), then releases the semaphore.
I happen to have posted a semaphore-file module here -- I picked it up and adapted it from a Perl Journal article by Sean Burke a couple years back. Works great on Solaris -- and even on ms-windows (tested on win98/2k).