Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

CGI::Session Question

by Perobl (Beadle)
on Sep 30, 2010 at 19:18 UTC ( #862840=perlquestion: print w/replies, xml ) Need Help??

Perobl has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks!

I'm using CGI::Session and everything is working fine save for the fact that my session files aren't being deleted after expiring. My code follows:

my $session = new CGI::Session("driver:File", undef, {Directory => '/h +ome/wiw/public_html/tmp'}); my $sid = $session -> id(); $session -> name('sid'); $session -> expire('+60m'); $session -> param('session_uid', $rray[0]); $session -> param('session_fname', $rray[1]); $session -> param('session_lname', $rray[2]); $session -> param('session_email', $email_crypt);

My session files are being created in my tmp directory, and they even expire after 60 minutes, but the files never get deleted. I was under the impression that $session -> expire('+60'); automatically cleans things up and unlinks the session file in the tmp directory, but maybe I'm interpreting the documentation incorrectly?

Thank you!

Replies are listed 'Best First'.
Re: CGI::Session Question
by Corion (Patriarch) on Sep 30, 2010 at 19:24 UTC
Re: CGI::Session Question
by Anonymous Monk on Sep 30, 2010 at 21:04 UTC
    automatically cleans things up and unlinks the session file in the tmp directory

    expiration is only checked when you load a session. If you never load a session, the data will hang around in your store forever (file will hang around forever). To remove expired sessions from disk use

    CGI::Session->find( sub {} );
    See also CGI::Session::ExpireSessions

      Thanks!

      I wasn't aware of this functionality:

      CGI::Session -> find( sub{} );

      This is exactly what I was looking for.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://862840]
Approved by toolic
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2022-06-30 15:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My most frequent journeys are powered by:









    Results (98 votes). Check out past polls.

    Notices?