Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners Cgi > Re: cleaning up...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 1397 of 1496
Post > Topic >>

Re: cleaning up as application ends

by mumia.w.18.spam+nospam@[EMAIL PROTECTED] (Mumia W.) May 13, 2007 at 11:15 PM

On 05/13/2007 05:32 PM, Mary Anderson wrote:
> Mumia,
>    Thanks for the mod_perl tip.  That
[http://perl.apache.org/docs/1.0/guide/****ting.html#END_blocks]
seems to
say that the code in the END 
> block will be executed when the server stops, not when the session comes
to 
> an end.
> 
>    My END blocks are executed well before the session comes to an end.
> 
>    If I do something like this:
> 
>     print header;
>     END {print "Ending Now", hr}
>     
>     my $login = param('Login');
> 
>     my $page_name = param('Go');
>     
>     if ($page_name eq 'Logged In'){
>         print "a({-href=>"./fubar", "fubar"});
>     }
>    
>     if (!$page_name){
>         print submit ({-name=>'Go', -Label = 'Logged In');
>     }
> 
> Then what happens when this (not real) code runs is that I type in
login, 
> hit the Logged In button, fubar is printed and then I see "Ending Now".
> 
> My session is still running.  I want code executed when the session
closes. 
> Is it possible to do this in cgi?  (I am beginning to think not.)
> 
> mary
> 

I'm assuming that you when you say session, you mean a group of requests 
that are associated with a single user. One option would be to execute 
the cleanup code when the user logs out; another option would be to 
periodically search for expired sessions and clean them up.

If you're using CGI::Session, you can probably subclass it and override 
the delete method to perform you cleanup operations (as well as call the 
superclass delete method).

You haven't confirmed what CGI-like environment you're using: mod_perl, 
fastcgi or regular CGI. Look at the do***entation for the CGI and 
session management libraries you're using; they should describe how to 
register cleanup code.
 




 2 Posts in Topic:
Re: cleaning up as application ends
mfanderson@[EMAIL PROTECT  2007-05-13 15:32:50 
Re: cleaning up as application ends
mumia.w.18.spam+nospam@[E  2007-05-13 23:15:24 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 10:31:28 CST 2008.