[Catalyst] exception handling?

Yuval Kogman nothingmuch at woobling.org
Tue Nov 15 19:26:40 CET 2005


BTW, using Catalyst::Plugin::Authorization::ACL might help. It sure
needs the testing =)

To get this done you should do something like:

	__PACKAGE__->deny_access_unless("/", sub { $_[0]->user }); # must be logged in
	__PACKAGE__->allow_access_if("/login", sub { 1 }); # always allow

	sub end : Private {
		my ( $self, $c ) = @_;

		if ( $c->error->[-1] && $c->error->[-1] =~ /access denied/) {A
			$c->stash->{explain_that_you_need_to_login} = 1;
			$c->detatch("/login/login");
		}

		...
	}

(I hope you're allowed to do that ;-)

-- 
 ()  Yuval Kogman <nothingmuch at woobling.org> 0xEBD27418  perl hacker &
 /\  kung foo master: /me does a karate-chop-flip: neeyah!!!!!!!!!!!!!!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20051115/056a829d/attachment.pgp


More information about the Catalyst mailing list