Hello All,
A few weeks ago, I asked how to delete the cgi session files, saved
on disk via the CGI::Session::file driver. I was pointed to the,
"find" method docs, which suggested trying:
CGI::Session->find( sub {} );
as a way to remove old session files. This doesn't seem to do a
thing, so I tried a variation of the next example:
CGI::Session->find( \&purge );
sub purge {
my ($session) = @_;
next if $session->empty; # <-- already expired?!
if ( ($session->ctime + 3600*240) <= time() ) {
$session->delete() or warn "couldn't remove " . $session-
>id . ": " . $session->errstr;
}
}
This, also didn't work - two points. commenting out the,
next if $session->empty; # <-- already expired?!
At least allowed my program to run (no errors reported?!) :)
The other point was that CGI::Session by default was looking in the "/
tmp" directory for these old session files. I received numerous
errors like this:
[Sun May 28 23:20:30 2006] script.cgi: couldn't remove
c7d30b81e15465627d7b955ab33dacfd: flush(): couldn't remove session
data: remove(): couldn't unlink '/tmp/
cgisess_0d9e96e65ba2691b8016d97920e74c6f': Operation not permitted
at /This/Here/App.pm line 528.
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 set
an explicit directory to save my session files into, ala:
require CGI::Session;
my $session = new CGI::Session(undef, undef, {Directory=>'/
home/myaccount/sessions'});
How do I pass this directory to CGI::Session, when using the find
method?
I tried something like:
CGI::Session->Directory('/home/myaccount/sessions');
But that doesn't seem to work.
Cheers,
Justin
On May 16, 2006, at 10:09 PM, Justin Simoni wrote:
> Thanks! I'll give this a shot and report my findings;
>
> Justin Simoni
>
> On May 16, 2006, at 9:38 PM, Sherzod Ruzmetov wrote:
>
>> Look up find() in CGI::Session 4.x. It wasn't thouroughly tested,
>> but the
>> purpose of find() is to make the cleanup task easier.
>>
>> Give it a shot. We'd appreciate the feedback.
>>
>>
>> Sherzod
>>
>>> -----Original Message-----
>>> From:
>>> cgi-session-user-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx
>>> [mailto:cgi-session-user-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx]
>>> On
>>> Behalf Of Justin Simoni
>>> Sent: Tuesday, May 16, 2006 10:33 PM
>>> To: Cgi-session-user-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx
>>> Subject: [Cgi-session-user] Are CGI::Session session files
>>> removed automatically?
>>>
>>>
>>> Heya,
>>>
>>> In previous versions of CGI::Session (ver. 3.x?) the default, "file"
>>> driver would not automatically remove session files that were
>>> expired. Is this still true in 4.13? In past versions, I used my own
>>> outside thingy to remove expired session files. If this isn't done
>>> automatically by CGI::Session, is there a similar routine I can use
>>> to remove these session files?
>>>
>>> Cheers,
>>>
>>> Justin Simoni
>>>
>>>
>>>
>>>
>>> -------------------------------------------------------
>>> Using Tomcat but need to do more? Need to support web
>>> services, security? Get stuff done quickly with
>>> pre-integrated technology to make your job easier Download
>>> IBM WebSphere Application Server v.1.0.1 based on Apache
>>> Geronimo
>>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&
>>> dat=121642
>>> _______________________________________________
>>> Cgi-session-user mailing list
>>> Cgi-session-user-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx
>>> https://lists.sourceforge.net/lists/listinfo/cgi-session-user
>>>
>>>
>>
>>
>
>
>
> -------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services,
> security?
> Get stuff done quickly with pre-integrated technology to make your
> job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> http://sel.as-us.falkag.net/sel?
> cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Cgi-session-user mailing list
> Cgi-session-user-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx
> https://lists.sourceforge.net/lists/listinfo/cgi-session-user
>
|