Re: [Cgi-session-user] Problems with find()
Brought to you by:
sherzodr
From: Matt L. <mle...@cp...> - 2006-06-14 22:37:40
|
On 6/14/06, Justin Simoni <ju...@sk...> wrote: > sub remove_old_session_files { > > my $self = shift; > require CGI::Session; > > # As of version 4.14 of CGI::Session... > #find( $dsn, \&code, \%dsn_args ) > CGI::Session->find(undef, \&purge_cgi_sess, {Directory=>$TMP}); > > sub purge_cgi_sess { > my ($session) = @_; > next if $session->empty; # <-- already expired?! > if ( ($session->ctime + 3600*48) <= time() ) { > $session->delete() > or warn "couldn't remove " . $session->id . ": > " . $session->errstr; > } > } > } Just a note: I'd suggest not declaring a subroutine within the body of another subroutine. > This is basically lifted off the CPAN docs, again. Thanks for the > notes on the various parameters you can pass to find(). > > One problem I do have, is on one install, the following error happens: > > Can't locate object method "empty" via package "CGI::Session" > > Removing the, > > next if $session->empty; # <-- already expired?! > > Seems to get rid of this error. > > Should this be, > > next if $session->is_empty; # <-- already expired?! > Yes, it should. I thought I fixed this; however, I obviously didn't. Patch has been applied to SVN. Thanks -Matt LeBlanc |