[Cgi-session-user] Problems with find()
Brought to you by:
sherzodr
From: Justin S. <ju...@sk...> - 2006-06-14 21:42:13
|
Hey ya'll, I'm still trying to tweak my old-session-file-remover thingy, it currently looks like this (I'm on CGI::Session 4.13) [snip] 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; } } } [/snip] 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?! ? I couldn't find a method called, "empty" anywhere in the CGI::Session source, but there is, "is_empty". Cheers, Justin Simoni -- :: is an eccentric artist, living and working in Denver, Colorado :: URL: http://justinsimoni.com :: PHO: 720.436.7701 :: Mailing List - http://justinsimoni.com/mailing_list.html |