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

Hi Monks!
I am trying to delete session left by the user, already expired. My code cant do that and no idea why not. Here is the part doing that, if any help will be really nice.
... if($del_sessions=~ /^cgisess_[a-f0-9]{32}$/) { my $session = CGI::Session->load( "driver:File", $del_sessions,{ D +irectory => '/sessions' } ) or die "$!"; # Delete session if ( $session->is_expired ) { $session->delete() if ($session); $session->flush() if ($session); } }
Thanks!

Replies are listed 'Best First'.
Re: Delete already expired CGI Sessions
by Anonymous Monk on Jan 16, 2011 at 06:09 UTC
    Asked and answered, use CGI::Session->find

    If you want help with your code, post a minimal, runnable, self contained code