[Catalyst] noob question about session timeouts

Matt S Trout dbix-class at trout.me.uk
Sat Nov 15 16:20:03 GMT 2008

On Sun, Nov 02, 2008 at 04:00:13PM -0500, Cliff Green wrote:
> When a session expires in the app I'm putting together, the user is sent 
> back to the login screen at the next request, as expected.  What I'd 
> like to do is stuff something like 'Session Expired' into 
> $c->stash->{error_msg} and have it displayed, letting the user know what 
> just happened.
> I've tried things like
>  unless ($c->session_expires) {
>     $c->stash->{error_msg} = 'Session Expired!';
>  }
> in, variously, Root.pm and Login.pm but of course it doesn't work.
> Alternatively, it would be nice to know how to use something along the 
> lines of
>  $c->stash->{error_msg} = $c->session_delete_reason;

That accessor is only set if the session was deleted this request, so why
not just do

if ($c->session_delete_reason) {


      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/

More information about the Catalyst mailing list