CGI-Mungo
view release on metacpan or search on metacpan
lib/CGI/Mungo/Session.pm view on Meta::CPAN
sub _expire{ #remove old session files
my $self = shift;
my $path = $self->_getPath();
if(opendir(COOKIES, $path)){
my @sessions = readdir(COOKIES);
my $expire = (time - 86400);
foreach(@sessions){ #check each of the cookies
my $prefix = $self->_getPrefix();
if($_ =~ m/^($prefix[a-f0-9]+)$/){ #found a cookie file
my $sessionFile = File::Spec->catfile($path, $1);
my @stat = stat($sessionFile);
if(defined($stat[9]) && $stat[9] < $expire){ #cookie is more than a day old, so remove it
unlink $sessionFile;
}
}
}
closedir(COOKIES);
}
}
############################################################################################################
#private methods
( run in 1.851 second using v1.01-cache-2.11-cpan-49f99fa48dc )