in reply to Locking PERL code another way

hm, maybe you want to have a look at enforcer.
itīs all early alpha but it seems to me that this is exactly what you whant, except that enforcer whatches the whole system and not only one or two files.