Re: [Cgi-session-user] Are CGI::Session session files removed automatically?
Brought to you by:
sherzodr
From: Justin S. <ju...@sk...> - 2006-05-29 07:09:55
|
Ron, > To get CGI::Session to look in the correct directory, perhaps > replace the above > line with: > > require CGI::Session; > my $session = new CGI::Session(undef, undef, {Directory=>'/ > home/myaccount/sessions'}); > $session -> find(\&purge); That worked perfectly. Thanks so much for that tip. I tried the below: require CGI::Session; my $session = new CGI::Session(undef, undef, {Directory=>'/home/ myaccount/sessions'}); CGI::Session->find(\&purge); But didn't catch my silly mistake. Thanks for the guidance! For completeness, here's my complete method, in my own session-handling module: [snip] sub remove_old_session_files { my $self = shift; if($self->{can_use_cgi_session} == 1 && $self-> {can_use_data_dumper} ==1){ require CGI::Session; my $session = new CGI::Session(undef, undef, {Directory=> $TMP}); $session->find( \&purge_cgi_sess ); sub purge_cgi_sess { my ($session) = @_; $session->Directory($TMP); next if $session->empty; # <-- already expired?! if ( ($session->ctime + 3600*48) <= time() ) { # two days... $session->delete() or warn "couldn't remove " . $session->id . ": " . $session->errstr; } } } } [/snip] The, "next if $session->empty; # <-- already expired?!" line that I reported as causing problems, doesn't seem to be problematic anymore. Cheers and thanks again for the guidance, Justin Simoni On May 29, 2006, at 12:30 AM, Ron Savage wrote: > On Sun, 28 May 2006 21:47:54 -0600, Justin Simoni wrote: > > Hi Justin > >> CGI::Session->find( \&purge ); > > To get CGI::Session to look in the correct directory, perhaps > replace the above > line with: > > require CGI::Session; > my $session = new CGI::Session(undef, undef, {Directory=>'/ > home/myaccount/sessions'}); > $session -> find(\&purge); > >> Which is CGI::Session trying to remove files that aren't owned by >> whatever is executing my app. Usually, when I run CGI::Session, I > > Perhaps you get permissions errors because: > o The sessions were created by a CGI app run by the web server and > hence owned > by the owner of the web server process > o The sessions are being deleted by you, and you're not the owner > of the web > server process > > -- > Ron Savage > ro...@sa... > http://savage.net.au/index.html > > > > > _______________________________________________ > Cgi-session-user mailing list > Cgi...@li... > https://lists.sourceforge.net/lists/listinfo/cgi-session-user > |