First suggestion: try using something like CGI::Persistent (admittedly not my favorite... I'm rolling my own CGI::Session for a project which does things very differently). There's a whole bunch of other persistent storage modules around, I think there's even a mailing list called <acronym>POOP</acronym> (Perl Object Oriented Persistence).
Why use these? They keep track of individual sessions (what if multiple people go to your web page at the same time?) and the associated file management etc.
As to your specific example: does the web user have permissions to modify the file? (I suggest you do not save session data in the same folder as your web scripts, which is what your example looks like it's doing ... you're asking for trouble securitywise if you do.)
You're also not locking the file. That could get you into trouble if somebody else tries to access the process (hey? what if the user doesn't like the speed of the page and hits reload? Imagine two processes from the same script are accessing the file, even if only one user is using the script).
In reply to Re: Keeping form information in CGI
by rrwo
in thread Keeping form information in CGI
by deryni
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |