[Catalyst] beginner question: MVC / HTML, recommended practice

Tobias Kremer t at funkreich.de
Fri Aug 4 09:44:25 CEST 2006


I would retrieve the data from the model (your database) in the
controller (lib/MyApp/Controller/...), stuff it in
$c->stash->{'myTableData'} (this can be an object, a perl data structure,
etc depending on how you retrieve your data) and iterate over it in the
template (/root/...) using a Template-Toolkit loop to generate the table.

HTH,

Toby


Zitat von Sarah Berry <berry.sarah at gmail.com>:

> I've searched the mailing list archives and reviewed the basic
> concepts of MVC programming. So far I think the HTML table should not
> be generated by the template, but rather by a separate Perl module
> that the template could then access. Is that correct? Would I generate
> the table in View/whatever.pm, concatenate the HTML into one long
> string, and put it in the stash? Or would I put the Perl script that
> generates the table into a .pl file and make it an include in the
> template? What's the Catalyst "best practice"?



More information about the Catalyst mailing list