Forum Moderators: coopster & phranque

Message Too Old, No Replies

locking a webpage for an update using perl

using forms to get the input from users

         

tropikana99

6:15 pm on Nov 13, 2002 (gmt 0)

10+ Year Member



Help!

I'm trying to write a perl script that will take inptus from a form on one page, e.g name, comments, and e-mail and add it to another one on the site.

I would like to know how I can lock the file so that two people can't simultaneously write to the file.

The comments are added at the bottom of the page, and if there is no lock on the file, one person is bound to overwrite someone else's coments. It is for a memorial for a friend who passed away.

Thanks. Also, if there is a better and simpler way of doing so with other languages or technologies. I'm open to suggestions.

jdMorgan

7:09 pm on Nov 13, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are you looking for something like this, using "flock" to establish exclusive access?

open(FORMFILE,">>$frmpath") ¦¦ die $!;
flock(FORMFILE,2);
print FORMFILE ("New stuff goes here\n");
close(FORMFILE);

Jim

seindal

8:06 pm on Nov 13, 2002 (gmt 0)

10+ Year Member



It sounds like a guestbook.
There are many implementations around.

See [freshmeat.net...]