Fixed so that session_expires == stored session expires
[catagits/Catalyst-Plugin-Session.git] / t / lib / SessionExpiry / Controller / Root.pm
1 package SessionExpiry::Controller::Root;
2 use strict;
3 use warnings;
4
5 use base qw/Catalyst::Controller/;
6
7 __PACKAGE__->config( namespace => '' );
8
9 sub session_data_expires : Global {
10     my ( $self, $c ) = @_;
11     $c->session;
12     if (my $sid = $c->sessionid) {
13         $c->finalize_headers(); # force expiration to be updated
14         $c->res->output($c->get_session_data("expires:$sid"));
15     }
16 }
17
18 sub session_expires : Global {
19     my ($self, $c) = @_;
20     $c->session;
21     $c->res->output($c->session_expires);
22 }