This approach makes your code and your templates much easier to
develop and maintain. If the people working on Perl application code
are different from those who develop the HTML pages, it allows them
to work on their separate areas without getting in each
other's way. Even if you're the one
doing all the work, it allows you to better separate the tasks and
wear just one hat at a time. When you're wearing
your application developer's hat, you can
concentrate on the Perl code and making it work right. When
you're wearing your web page
designer's hat, you can concentrate on the HTML
markup and making it look good.
It also makes your backend code and your frontend templates more
reusable. You can have the same backend code running behind multiple
sets of frontend templates, ideal for creating different versions of
the same web site localized to spoken languages or customized to
different users' requirements. You can also reuse
the same set of templates in front of different backend applications,
CGI scripts, and mod_perl handlers. Common elements such as headers,
footers, and menus can be encoded as templates and then shared
between your static pages generated via ttree
and your dynamic pages generated online. The result is that you get a
consistent user interface and presentation style for all your pages,
regardless of how they're generated.
| | |
D.2. Overview | | D.4. Template Toolkit Language |