songahji has asked for the wisdom of the Perl Monks concerning the following question:
If case there is a thread already discussing this issue, my apology and please redirect me and I'll read up.
Anyway, I am writing CGI form which creates a new file in a solaris box. Numbers is the filename. There is a history file which stores the last number used. What can I do to make sure that the filename will not get clobbered? I am using following routine:
$fn_number = get_latest_filename(); # read the history file while ( -e $fn_number ) { $fn_number++; update_fn_number(); # update the history file } write_thefile($fn_number);
I tested with 3 users at the submitting the form at same time (well, I tried to make sure three of us clicking the submit button at the same time) and 1 out of 5 testing the form clobbers.
TY,
songahji
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI filename race
by Joost (Canon) on Aug 27, 2007 at 18:38 UTC | |
|
Re: CGI filename race
by Fletch (Bishop) on Aug 27, 2007 at 18:40 UTC | |
|
Re: CGI filename race
by kyle (Abbot) on Aug 27, 2007 at 19:22 UTC | |
by Fletch (Bishop) on Aug 27, 2007 at 20:00 UTC |