[Catalyst] question from tutorial - does creating HTML in a
controller using HTML::Widget violate MVC?
Nilson Santos Figueiredo Junior
acid06 at gmail.com
Wed Dec 6 00:51:23 GMT 2006
On 12/5/06, Sebastian Riedel <sri-lists at oook.de> wrote:
> HTML::Widget was an experiment and i wouldn't suggest using it anymore.
> There should be a TT plugin imo similar to the CGI.pm one, just sane. :)
IMO, the real thing that's missing is Perl code layer between the
controller and the template, i.e., the view should be composed by code
+ templates. If you don't do it this way you need to either a) put
code which belongs to the view inside your controller, b) write large
amounts of code in your templates using and reap *all* the great
benefits that come along with large chunks of code written in TT
language or c) write a TT plugin.
"a" is fundamentally wrong, "b" will give you nightmares, "c" is
arguably clumsy and not practical at all.
Actually, someone could come up with a view class which would first
call some Perl code and then process the TT template. It could have
sane defaults so that it'd do the same sort of lookup that TT already
does for templates, e.g. the requested action was "/some/thing" then
if your view is called "MyApp::View::PerlTT" it'd look for method
"thing" in "MyApp::View::PerlTT::Some" and *then* the already existing
View::TT template finding logic would kick in. For relatively simple
templates, the Perl code part couldn't even exist and then the
template would be processed directly. It shouldn't be something very
hard to do.
-Nilson Santos F. Jr.
More information about the Catalyst