For Programmers: Free Programming Magazines  


Home > Archive > PERL Modules > December 2004 > Start an Event when a Session ends









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Start an Event when a Session ends
Santinho

2004-12-20, 3:56 pm


Esteemed Perl Fellows,

Is it possible to start an event when a Session ends, using Apache, mod_cgi and CGI::Session?

For example:

When a user enters one web page, I start one session and write a txt file. The txt file's name is the user's session ID. So far so good.

If I have a button or a link to exit my site, and the user clicks it, I can safely delete the txt file. But, if the user closes his/her browser's window? The session is destroyed but I can't delete the file.

Any way to do this as easy as in ASP (remember the global.asa file) ?
Or any way at all?

Note: I don't have mod_perl nor Apache::ASP :(

Thanks for your time
Miguel

Sherm Pendley

2004-12-20, 3:56 pm

Santinho wrote:

> If I have a button or a link to exit my site, and the user clicks it,
> I can safely delete the txt file.


Only if *every* link away from your site goes through a CGI that cleans
up the session. Otherwise you won't even notice them leave.

> But, if the user closes his/her
> browser's window? The session is destroyed but I can't delete the file.


Right.

> Any way to do this as easy as in ASP (remember the global.asa file) ?


ASP can't do it either. ASP isn't magic, it's just scripting embedded in
a page - it can't tell any more than Perl can when a browser window closes.

> Or any way at all?


Easy: Just schedule a cron task that cleans up stale session files, and
does any other related housekeeping at the same time.

None of this is relevant to *any* c.l.perl.* news group, by the way. The
answer would be the same if you were using a Python script. Try
comp.infosystems.www.authoring.cgi next time.

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com