use Object::Signature ();
use Carp;
-our $VERSION = "0.17";
+our $VERSION = '0.20';
my @session_data_accessors; # used in delete_session
BEGIN {
$c->NEXT::prepare_action(@_);
}
-sub finalize {
+sub finalize_headers {
my $c = shift;
- $c->NEXT::finalize(@_);
+ # fix cookie before we send headers
+ $c->_save_session_expires;
+ return $c->NEXT::finalize_headers(@_);
+}
+
+sub finalize {
+ my $c = shift;
+ my $ret = $c->NEXT::finalize(@_);
+
+ # then finish the rest
$c->finalize_session;
+ return $ret;
}
sub finalize_session {
$c->_save_session_id;
$c->_save_session;
$c->_save_flash;
- $c->_save_session_expires;
$c->_clear_session_instance_data;
}
sub flash {
my $c = shift;
$c->_flash_data;
- $c->_set_flash(@_);
- return $c->_flash;
+ $c->_set_flash(@_);
+ return $c->_flash;
}
sub clear_flash {
=head1 NAME
-Catalyst::Plugin::Session - Generic Session plugin - ties together server side
-storage and client side state required to maintain session data.
+Catalyst::Plugin::Session - Generic Session plugin - ties together server side storage and client side state required to maintain session data.
=head1 SYNOPSIS
Session::State::Cookie
/;
- # you can replace Store::FastMmap with Store::File - both have sensible
- # default configurations (see their docs for details)
+ # you can replace Store::FastMmap with Store::File - both have sensible
+ # default configurations (see their docs for details)
- # more complicated backends are available for other scenarios (DBI storage,
- # etc)
+ # more complicated backends are available for other scenarios (DBI storage,
+ # etc)
# after you've loaded the plugins you can save session data
=item keep_flash @keys
-If you wawnt to keep a flash key for the next request too, even if it hasn't
+If you want to keep a flash key for the next request too, even if it hasn't
changed, call C<keep_flash> and pass in the keys as arguments.
=item delete_session REASON
parameter is on - then it will copy the contents of the flash to the stash at
prepare time.
+=item finalize_headers
+
+This method is extended and will extend the expiry time before sending
+the response.
+
=item finalize
-This method is extended and will extend the expiry time, as well as persist the
-session data if a session exists.
+This method is extended and will call finalize_session after the other
+finalizes run. Here we persist the session data if a session exists.
=item initialize_session_data
=over 4
-=item *
-
-A counter
-
-=item *
-
-The current time
-
-=item *
-
-One value from C<rand>.
+=item * A counter
-=item *
+=item * The current time
-The stringified value of a newly allocated hash reference
+=item * One value from C<rand>.
-=item *
+=item * The stringified value of a newly allocated hash reference
-The stringified value of the Catalyst context object
+=item * The stringified value of the Catalyst context object
=back
See L<Catalyst/dump_these> - ammends the session data structure to the list of
dumped objects if session ID is defined.
+
+=item calculate_extended_session_expires
+
+=item calculate_initial_session_expires
+
+=item create_session_id_if_needed
+
+=item delete_session_id
+
+=item extend_session_expires
+
+=item extend_session_id
+
+=item get_session_id
+
+=item reset_session_expires
+
+=item session_is_valid
+
+=item set_session_id
+
=back
=head1 USING SESSIONS DURING PREPARE
C<prepare_action> L<Catalyst::Plugin::Session> will actually load the data from
the store.
- sub prepare_action {
- my $c = shift;
+ sub prepare_action {
+ my $c = shift;
- # don't touch $c->session yet!
+ # don't touch $c->session yet!
- $c->NEXT::prepare_action( @_ );
+ $c->NEXT::prepare_action( @_ );
- $c->session; # this is OK
- $c->sessionid; # this is also OK
- }
+ $c->session; # this is OK
+ $c->sessionid; # this is also OK
+ }
=head1 CONFIGURATION
=head1 AUTHORS
-=over 4
-
-=item Andy Grundman
+Andy Grundman
-=item Christian Hansen
+Christian Hansen
-=item Yuval Kogman, C<nothingmuch@woobling.org> (current maintainer)
+Yuval Kogman, C<nothingmuch@woobling.org> (current maintainer)
-=item Sebastian Riedel
-
-=back
+Sebastian Riedel
And countless other contributers from #catalyst. Thanks guys!
=head1 COPYRIGHT & LICENSE
- Copyright (c) 2005 the aforementioned authors. All rights
- reserved. This program is free software; you can redistribute
- it and/or modify it under the same terms as Perl itself.
+ Copyright (c) 2005 the aforementioned authors. All rights
+ reserved. This program is free software; you can redistribute
+ it and/or modify it under the same terms as Perl itself.
=cut