[Catalyst] Re: template comparison

Adam Sjøgren asjo at koldfront.dk
Fri Oct 27 23:46:08 BST 2006


On Fri, 27 Oct 2006 13:02:47 -0500, Jonathan wrote:

> Mason:

> <table><% my $sth = $dbh->prepare('SELECT columns FROM table WHERE
> something=1'); for($row = $sth->fetchrow_arrayref){ %></table>

[...]

> TT (in Cat with DBIC):

> <table>
> [% WHILE (row = rows.next) %]
> <tr>
>   <td>[% row.name | html %]</td><td>[% row.whatever | html %]</td>
> </tr>
> [% END %]
> </table>

I think a fair comparison would be:

 Mason (in Catalyst using DBIx::Class):

 <table>
 % while (my $row=$rows->next) {
 <tr>
   <td><% $row->name |h %></td><td><% $row->whatever |h %></td>
 </tr>
 % }
 </table>

For me there is not much gained by learning yet another syntax for
looping, branching, outputting stuff (Template::Toolkit), when I can
use the Perl-syntax I am familiar with, by using Mason.

That is why I use Catalyst::View::Mason.


There is, of course, the risk of abusing the power of Perl, in
Mason-components - with more power comes more responsibility¹.


(I am biased by previously having used Mason as "the whole system" for
building some websites, and (ab)using it for "just templating" in a
larger system - so I knew Mason - and made a lot of mistakes with/in
it - before I got to know Catalyst).


  Best regards,

     Adam


¹ My apologies to Yoda :-)

-- 
 "This reporter was clearly from the "stenography"            Adam Sjøgren
  school of reporting. Math is hard, let's go shopping."  asjo at koldfront.dk



More information about the Catalyst mailing list