[Catalyst] question from tutorial - does creating HTML in a controller using HTML::Widget violate MVC?

Perrin Harkins perrin at elem.com
Wed Dec 6 01:17:59 GMT 2006


Nilson Santos Figueiredo Junior wrote:
> c) write a TT plugin.
[...]
> "c" is arguably clumsy and not practical at all.

It can be really easy to add custom view code to TT templates.  You can 
immediately load any class and just call it:

[% USE MyView %]
[% MyView.method(arg) %]

If it supports a new() constructor, you can even have instances of it 
with different constructor args:

[% USE two_column = View::MultiColumn(2) %]

Or you can pass a sub ref to the stash with your data and just call it:

[% sub_ref(arg) %]

There's no need to do anything special for TT or make a "plugin" unless 
you want to do something that requires access to the TT internals.

- Perrin



More information about the Catalyst mailing list