the tricky part is the "admin who has opened up the file in 'vi' and editing the file". this kind of manually open editing behavior is hard to track for the locking module that you just mention. the following provides you with a simple(not perfect at all and it's slow) method and it searches your process table for anyone who has open the tmp.pl(you will want to change this to the script that you want to track) in vi:
#!/usr/bin/perl -w use strict; use Proc::ProcessTable; my $t = new Proc::ProcessTable; foreach my $p (@{$t->table}){ next unless $p->cmndline =~ /vi.*tmp\.pl/; print "Someone already editing: tmp.pl with ",$p->cmndline,"\n"; } __END__ now if i open tmp.pl like: vi tmp.pl and then run the script, the script will print: Someone already editing tmp.pl with vi tmp.pl this method is slow and is not 100%. what happen if your admin decided to use another editor than vi? no luck... however, i hope the above can provide you with something to get going... for all of the other locking modules you mention, your OS usually have to support the flock system call or they will not work(usually silently) david Ramprasad A Padmanabhan wrote: > Hi All, > I am writing an web application where multiple users may write into > the same file concurrently. Also there is a probability that there may > be an admin who has opened up the file in 'vi' and editing the file. > > I want to avoid this concurrent multiple opens. > I tried a range on perl modules like IO::LockedFile, File::Flock; > LockFile::Simple etc but all these do not enforce any lock and worst > they lock a file even if it is already open in vi > > Any Help > Ram -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]