merlyn@stonehenge.com (Randal L. Schwartz) writes: > Use the "highlander" solution: > > #!/usr/bin/perl > > BEGIN { > use Fcntl ':flock'; > flock DATA, LOCK_EX | LOCK_NB or exit 0; # I'm already running > } > > [ rest of your script here ] > > __END__ > > To do this, you must have __END__ at the end of your script, or else DATA > is not opened.
Very elegant. I like that. Unfurtunately I can't get that to work on HP-UX. A trace with tusc shows that the fcntl syscall on DATA always fails with errno=9 (EBADF) Not a big problem, the easy solution is to open a real file and lock that one like above. That works. I just thought someone was interested to know this. -- Christer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>