[Catalyst] :Template() Attribute

John Napiorkowski jjn1056 at yahoo.com
Sun Jun 17 02:57:15 GMT 2007


--- Jonathan Rockway <jon at jrock.us> wrote:

> On Friday 15 June 2007 08:36:33 am Christopher H.
> Laco wrote:
> 
> > OPTION #2: View::TT, View::Mason, View::**
> > ----------------------------------------------
> >
> > PROS:
> >
> > Template() will be honored with the use of
> RenderView and the use of
> > forwarding to a view manually (like in REST or
> other controller code).
> >
> > CONS:
> >
> > This has to be implemented in each View::**
> package that wants to
> > support it.
> >
> > IF one changes from a view the support it, to one
> that doesn't,
> > controllers go boom.
> >
> 
> What we really need to do is add a utility method
> like template_name() to the 
> Catalyst::View base class.  Even without the
> :Template attribute, there is 
> code duplicated between every view that shouldn't
> be( $template = 
> $c->action || $c->stash->{template} ). 
> 
> Let's factor that out into to Catalyst::View, fix
> the views in svn, and then 
> you can add the :Template code there.  It needs to
> be done, and your feature 
> is the, uh, catalyst for change.
> 
> Thoughts?

This would make a great Moose Role.  I never liked
'template' being part of the stash and typically
avoided using it.  But it still got me a few times
when I had some database tables named 'Template' :)

I'd like to see this factored so that it would be a
role Role for controllers as well.  But I think we
need to think a little about how the Views get
dispatched to.  Right now most of use just have
something stuck in the Root controller.  Perhaps if
this is working for use we should canonicalize it as
something?

-john

> 
> -- 
> package JAPH;use Catalyst
> qw/-Debug/;($;=JAPH)->config(name => do {
> $,.=reverse qw[Jonathan tsu rehton lre rekca
> Rockway][$_].[split //,
> ";$;"]->[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;->setup;
> 
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo:
> http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive:
>
http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/
> 



      ____________________________________________________________________________________
Park yourself in front of a world of choices in alternative vehicles. Visit the Yahoo! Auto Green Center.
http://autos.yahoo.com/green_center/ 



More information about the Catalyst mailing list