[Catalyst] Check is session is expired

Alexander Hartmaier alexander.hartmaier at t-systems.at
Fri Apr 16 12:02:36 GMT 2010


You have to $c->detach() right after the redirect to stop further
execution of the current action.
If you're doing the redirect in an auto method you might also return a
false value.

--
Best regards, Alex


Am Freitag, den 16.04.2010, 11:51 +0200 schrieb David:
> Regarding session expiring, I am having a little problem.
>
> I want to redirecto to login page whenever session is expired. It
> works allright, but when I do the redirect in a Controller index
> method ( sub index :Path :Args(0){} ), I always get next error
> message:
>
> Caught exception in engine "Can't call method "as_string" on an
> undefined value at /usr/local/share/perl/5.8.8/Catalyst/Engine.pm line
> 95."
> Browser gets 404 HTTP Error, because instead of being redirect to
> login page, it is redirect to the same page, the page which is served
> int the index method.
>
> I have made tests, and the redirect doesn't seem to be working right
> in this case. Code is executed after redirect, instead of stopping
> executing.
>
> Redirect looks like: $c->response->redirect($c->uri_for('/'));
>
>
> David
>
>
>
>
> ______________________________________________________________________
> De: Ben Hitz <hitz at genome.stanford.edu>
> Para: The elegant MVC web framework <catalyst at lists.scsys.co.uk>
> Enviado: jue,15 abril, 2010 18:59
> Asunto: Re: [Catalyst] Check is session is expired
>
> $c->session->session_expires) returns 0 when the session is expired
> (and deletes the session).
>
> Caveat: I am brand new - never installed the sw, but I was JUST
> reading this in the docs.
>
> Ben
>
> On Apr 15, 2010, at 8:33 AM, David wrote:
>
> > Hi,
> >
> > Is there any method in order to check if user session has expired,
> so that user is redirect to login page?
> > Something like $c->session->is_expired which returns true or false?
> >
> > I've checked Catalyst Session Plugin, but I havem't found any method
> to check if session has expired.
> >
> > David
> >
> >
> > _______________________________________________
> > List: Catalyst at lists.scsys.co.uk
> > Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> > Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> > Dev site: http://dev.catalyst.perl.org/
>
> --
> Ben Hitz
> Senior Scientific Programmer ** Saccharomyces Genome Database ** GO
> Consortium
> Stanford University ** hitz at genome.stanford.edu
>
>
>
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
>


*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
T-Systems Austria GesmbH   Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
Notice: This e-mail contains information that is confidential and may be privileged.
If you are not the intended recipient, please notify the sender and then
delete this e-mail immediately.
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*



More information about the Catalyst mailing list