[Catalyst] :Template() Attribute

Jonathan Rockway jon at jrock.us
Sun Jun 17 02:37:46 GMT 2007


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?

-- 
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;



More information about the Catalyst mailing list