From: Yuval Kogman Date: Fri, 15 Sep 2006 19:10:07 +0000 (+0000) Subject: various changes to C::P::Session, including clear_flash X-Git-Tag: v0.13~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4972769710d28b7cdc1187853f4c9814a9e1af3e;hp=8f2365272c8afa6dd721be4806aabf95f8650014;p=catagits%2FCatalyst-Plugin-Session.git various changes to C::P::Session, including clear_flash --- diff --git a/Changes b/Changes index 8ca9440..2eea8b5 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,10 @@ Revision history for Perl extension Catalyst::Plugin::Session -0.012 +0.13 + - add `clear_flash` + - improve debug logging + +0.12 - refactor out a hookable finalize_session method, for plugins - make _clear_session_instance_data call NEXT::, so that plugins can hook on to that too diff --git a/lib/Catalyst/Plugin/Session.pm b/lib/Catalyst/Plugin/Session.pm index 29e4d82..887fb28 100644 --- a/lib/Catalyst/Plugin/Session.pm +++ b/lib/Catalyst/Plugin/Session.pm @@ -99,14 +99,14 @@ sub finalize { sub finalize_session { my $c = shift; + $c->NEXT::finalize_session; + $c->_save_session_id; $c->_save_session; $c->_save_flash; $c->_save_session_expires; $c->_clear_session_instance_data; - - $c->NEXT::finalize_session; } sub _save_session_id { @@ -261,7 +261,7 @@ sub _clear_session_instance_data { sub delete_session { my ( $c, $msg ) = @_; - $c->log->debug("Deleting session") if $c->debug; + $c->log->debug("Deleting session" . ( defined($msg) ? "($msg)" : '(no reason given)') ) if $c->debug; # delete the session data if ( my $sid = $c->sessionid ) { @@ -388,6 +388,12 @@ sub flash { } } +sub clear_flash { + my $c = shift; + $c->_flash_key_hashes({}); + $c->_flash({}); +} + sub session_expire_key { my ( $c, %keys ) = @_; @@ -639,6 +645,10 @@ of every request. } } +=item clear_flash + +Zap all the keys in the flash regardless of their current state. + =item keep_flash @keys If you wawnt to keep a flash key for the next request too, even if it hasn't