sierrathedog04 has asked for the wisdom of the Perl Monks concerning the following question:
Later, in a different form handler, one can retrieve the previously stored values as follows:unless (open (Q_NEW_USER, ">/home/web/new_user.dat")) { print "Unable to open file for data storage."; } else { $q->save(\*Q_NEW_USER); }
The above code works great as long as only one user is accessing the form at a time. But if two users access the form concurrently then the second user can see the first user's data.unless (open (Q_NEW_USER, "/home/web/new_user.dat")){ my $message = "unable to open data file."; $q_new_user = new CGI; } else { $q_new_user = new CGI (\*Q_NEW_USER); }
Clearly, the problem is that every query object is stored using the same filename.
What would be the best way to provide for access by multiple concurrent users? I might mention that the site uses an Apache .htpasswd file to restrict access so that every user has his own unique login to the Apache 1.3 webserver.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Managing Concurrent CGI.pm Query Objects
by mr.nick (Chaplain) on Mar 28, 2001 at 06:42 UTC | |
|
Re: Managing Concurrent CGI.pm Query Objects
by arturo (Vicar) on Mar 28, 2001 at 06:43 UTC | |
|
Re: Managing Concurrent CGI.pm Query Objects
by clintp (Curate) on Mar 28, 2001 at 06:37 UTC | |
|
Re: Managing Concurrent CGI.pm Query Objects
by damian1301 (Curate) on Mar 28, 2001 at 06:33 UTC |