Alex Povolotsky wrote:
Martin Ellison wrote:
Is there anything attached to Catalyst similar to the CGI.pm module? That is, creating the HTML by a series of procedure calls rather than by instantiating a template?

Creating HTML inside the code is the best way to make unreadable, unmaintainable program with mysterious errors.

Also, Kieren Diment wrote:

> I'd really recommend that you use a proper template engine,
> otherwise your code will grow into a horrible monster before you know it.

It seems to me that these are generalizations. They are often true, but
it is indeed possible to create html inside your code, while keeping
a clean and oo approach.

For example, I designed and maintained for years a web framework where
we allowed something like:

   my $table = html::styledtable->new(skin=>'whatever');
   my $chart = html::chart->(type=>'pie3d', data=>[EMAIL PROTECTED]);
   my $tree  = html::treeview->new(plugin=>'filesystem', subtree=>'/mypath');
   my $doc   = html::document->new(splashscreen=>1);

   $table->add_row('this', 'that');
   $table->add_row($chart);
   $table->set_cell_opt(1, 0, colspan=>2);

   $doc->body->add($table);
   $doc->body->add($tree);

We had many kind of html "widgets", from simple ones, like 'table',
to complex ones, like 'treeview' or 'multiselect', or charts.

You can still separate (almost) clearly your presentation from your application logic, and your code is highly maintainable,
at least IMO.

You can also evolve (or change completely) your application presentation, or even changing the underlying layer to use pre-made templates, without
touching a single line of application code.

--
Cosimo


_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to