On Tue, 11 Dec 2012 11:40:29 +0000
Daniel Perrett <[email protected]> wrote:
> Perhaps I'm missing something but...
>
> "how requires_login/requires_role would store the fact that the
> provided sub requires auth"
>
> Simple implementation:
>
> # given has_role is calculable
>
> sub requires_role {
> my ($role, $code, $handle_exception) = @_;
> return sub {
> if (has_role($role)){
> $code->(@_);
> }
> else{
> if (defined $handle_exception){
> $handle_exception->($role, @_)
> }
> else {
> default_403_no_role($role, @_)
> }
> }
> }
> }
Ah, yes - that's pretty clever. I think like that approach - it's
simple and solid.
Thanks!
--
David Precious ("bigpresh") <[email protected]>
http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter
www.preshweb.co.uk/linkedin www.preshweb.co.uk/facebook
www.preshweb.co.uk/cpan www.preshweb.co.uk/github
_______________________________________________
dancer-users mailing list
[email protected]
http://lists.preshweb.co.uk/mailman/listinfo/dancer-users