MVC (Re: DBIx::Class - Related Tables)

Raphael Mankin raph at mankin.org.uk
Tue Oct 7 14:09:02 BST 2008


On Tue, 2008-10-07 at 14:48 +0200, Paul Johnson wrote:
> On Tue, Oct 07, 2008 at 01:33:02PM +0100, Raphael Mankin wrote:
> > 
> > On Tue, 2008-10-07 at 12:50 +0100, Andy Wardley wrote:
> > > 
> > >     [% # display custom panel based on user status
> > >        IF user.is_admin;
> > >           INCLUDE admin/controls;
> > >        ELSIF user.is_logged_in;
> > >           INCLUDE user/greeting;
> > >        ELSE;
> > >           INCLUDE user/login;
> > >        END;
> > >     %]
> 
> > If there were many such IF statements in my templates I would tend to
> > use separate templates for the user states (or whatever) and let the
> > controller route to the appropriate one.
> 
> Every conditional is a missed opportunity for a derived class.
> 
Agreed, but you still need logic somewhere to decide which derived class
to use. This discussion is, partly, about where to put that logic.



More information about the london.pm mailing list