"A straightforward and reliable module for managing sessions is CGI::Session."
Indeed.
I've been using this module for 2 years now. Unfortunately, I still can't (or don't know how to do it) start some code when a session is destroyed when one user closes his/her browser. On the other hand, I know how to handle $session->delete() and all the functions.
Suppose I have a program that writes some info in a txt file, containing the $session->id() and some more stuff.
If the user presses the logoff button I delete that file. But if the user closes his/her browser's window... the connection with the program is closed and the session is destroyed, but the file remains intact.
How can I delete a temporary file associated with a user's session ID when he/she closes his/her browser? |