Revision history for Perl extension Catalyst::Plugin::Session
+0.012
+ - 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
+
0.11
- Lazify expiry calculation and store it in a different instance data
slot. This provides greater flexibility for implementing hooks like
use overload ();
use Object::Signature ();
-our $VERSION = "0.11";
+our $VERSION = "0.12";
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->_save_session_id;
$c->_save_session;
$c->_save_flash;
$c->_clear_session_instance_data;
- $c->NEXT::finalize(@_);
+ $c->NEXT::finalize_session;
}
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 {
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