sub Attributes (was Re: [Catalyst] How to do pass-through login?)
    Tomas Doran 
    bobtfish at bobtfish.net
       
    Sun Jul 12 12:15:26 GMT 2009
    
    
  
On 12 Jul 2009, at 08:44, Zbigniew Lukasiak wrote:
> By the way - theoretically all this could be equivalently coded as
> something like:
>
> package MyController;
> use ....
> with ACL;
>
> sub foo : Local {
>   ($self, $c, @args ) = @_;
>   $self->check_acl_role( 'admin', 'denied' );
>
>
> It seems that people prefer the attributes - I guess because they are
> more declarative.
Oh yes, it totally can. However, an actionrole can be applied totally  
by configuration...
sub foo : Local {
# Code
}
__PACKAGE__->config( actions => { foo => { Does => 'ACL',  
RequiresRole => 'admin', ACLDetachTo => 'denied' }} );
no changes to code actually required, as this can obviously come from  
config.. Fairly useful as the business folks seem never to be able to  
decide who can do what, so making it config makes their indecision  
cheaper to support. ;)
Cheers
t0m
    
    
More information about the Catalyst
mailing list