[Catalyst] Re: Calling Controller Methods from inside begin or auto.

Derek Wueppelmann dwueppel at gmail.com
Wed Sep 30 12:23:56 GMT 2009


On Tue, 2009-09-29 at 14:39 +0200, Aristotle Pagaltzis wrote:
> * monkey <dwueppel at gmail.com> [2009-09-29 14:35]:
> > Is there another way to do the above without having to write
> > the auth handling at the top of every method used to display
> > pages?
> 
> Chained dispatch. Do an auth check early in the chain, then the
> actions down the chain don’t need to do it.

So I found a different way to do this. It's pretty close to my original
method I had mentioned, but instead of calling $self->auth_required I
changed it to:

	$c->action->class->auth_required()

Which has the desired effect. Now all I need to do is if a controller
does not require authentication in order to be viewed I override the
auth_required method in that controller to return 0 instead of the
default 1.

-- 
 o)   Derek Wueppelmann           (o
(D .   dwueppel at gmail.com          D).
((`     http://www.monkeynet.ca   ( ) `





More information about the Catalyst mailing list