I tend to try to put logic concerns in the application, and presentation concerns in the template. Usually, one subroutine is called to build the page. It assembles information in its local variables, sometimes also defines a “closure” (a code-ref) that the template will use to withdraw the information that it needs, then invokes the template. The information it needs is prepared in advance. The template drives how it looks, and if Marketing wants to completely re-design that, the program won’t break.