use overload ();
use Object::Signature ();
-our $VERSION = "0.11";
+our $VERSION = "0.13";
my @session_data_accessors; # used in delete_session
BEGIN {
sub finalize {
my $c = shift;
+ $c->finalize_session;
+
+ $c->NEXT::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(@_);
}
sub _save_session_id {
sub _clear_session_instance_data {
my $c = shift;
$c->$_(undef) for @session_data_accessors;
+ $c->NEXT::_clear_session_instance_data; # allow other plugins to hook in on this
}
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 ) {
}
}
+sub clear_flash {
+ my $c = shift;
+
+ #$c->delete_session_data("flash:" . $c->sessionid); # should this be in here? or delayed till finalization?
+ $c->_flash_key_hashes({});
+ $c->_flash_keep_keys({});
+ $c->_flash({});
+}
+
sub session_expire_key {
my ( $c, %keys ) = @_;
}
}
+=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
Also have a look at L<Crypt::Random> and the various openssl bindings - these
modules provide APIs for cryptographically secure random data.
+=item finalize_session
+
+Clean up the session during C<finalize>.
+
+This clears the various accessors after saving to the store.
+
=item dump_these
See L<Catalyst/dump_these> - ammends the session data structure to the list of