Templates and Code Separation
Templates defining the overall look and behavior of a site are a natural extension of the idea of embedding Perl code in HTML. Templates can be viewed as HTML-centric pages with smaller Perl snippets, which stand for abstract parts of the Web application interface. In fact, there's no better way to think of thembecause Perl and HTML are both known quantities, viewing a template system as Perl-in-HTML makes it much easier to implement. The details can be tricky, however.
Code separation also is a tricky topic because the code part of an application can't be completely separate from the display part of the application. It's possible to create abstractions of each in the arena of the other, but there's no complete way to separate the two because there always has to be a connection point. Embedding code in HTML provides a good interface that doesn't have to give up either the robustness of code or the simplicity of HTML. In addition, it takes away the need to create an artificial third layer that might not have the strengths of either.