Catalyst::Plugin::Session::DynamicExpiry - per-session custom expiry times
# put Session::DynamicExpiry in your use Catalyst line # note that for this plugin to work it must appear before the Session # plugin, since it overrides some of that plugin's methods. use Catalyst qw/ ... Session::DynamicExpiry Session /; if ($c->req->param('remember') { $c->session_time_to_live( 604800 ) # expire in one week. }
This module allows you to expire session cookies indvidually per session.
If the session_time_to_live field is defined it will set expiry to that many seconds into the future. Note that the session cookie is set on every request, so a expiry of one week will stay as long as the user visits the site at least once a week.
session_time_to_live
Once ttl has been set for a session the ttl will be stored in the __time_to_live key within the session data itself, and reused for subsequent request, so you only need to set this once per session (not once per request).
__time_to_live
This is unlike the ttl option in the config in that it allows different sessions to have different times, to implement features like "remember me" checkboxes.
To set the TTL for this session use this method.
Overridden to implement dynamic expiry functionality.
When it just doesn't work, it's usually because you put it after Catalyst::Plugin::Session in the plugin list. It must go before it so that it can override Catalyst::Plugin::Session's methods.
Marcus Ramberg, mramberg@cpan.org Yuval Kogman
mramberg@cpan.org
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
To install Catalyst::Plugin::Session::DynamicExpiry, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::Plugin::Session::DynamicExpiry
CPAN shell
perl -MCPAN -e shell install Catalyst::Plugin::Session::DynamicExpiry
For more information on module installation, please visit the detailed CPAN module installation guide.