[Catalyst-dev] Plugin or controller?

Matt S Trout dbix-class at trout.me.uk
Mon Jun 8 19:02:11 GMT 2009


On Mon, Jun 01, 2009 at 05:50:57PM +0200, Matthias Dietrich wrote:
> Hi,
> 
> >You haven't in any way explained why you think it _needs_ to be a  
> >plugin.
> >
> >Therefore, it doesn't need to be, and so shouldn't be. ;)
> 
> if you argue that way, nothing needs to be anything (because opinions  
> are different) ;).
> 
> The module provides a thin wrapper around Algorithm::FloodControl and  
> implements one function that can be called within a controller action  
> to decide, what to do.

In which case it doesn't need to wrap the request cycle so it should be
a controller superclass, not a plugin.

If the logic gets complicated I'd then make it a controller superclass
that delegates to a model, but I'm not sure in this case it's complex
enough to be worth doing that.

> It's like the Authorization plugin.

Authorization::Roles probably shouldn't have been a plugin either.

I always just use methods on the user object ...

> And  
> because it only implements this helper function, the controller  
> namespace is a bit confusing.

I'd probably implement it as a role rather than a superclass for 5.80.

-- 
        Matt S Trout         Catalyst and DBIx::Class consultancy with a clue
     Technical Director      and a commit bit: http://shadowcat.co.uk/catalyst/
 Shadowcat Systems Limited
  mst (@) shadowcat.co.uk        http://shadowcat.co.uk/blog/matt-s-trout/



More information about the Catalyst-dev mailing list