What are common pitfalls or gotchas with template systems (Template Toolkit)?

Template systems like Template Toolkit can greatly simplify web development by separating logic from presentation. However, there are common pitfalls to watch for:

Template Toolkit, web development, pitfalls, templating issues, best practices

<% # Common pitfalls # 1. Mixing logic with presentation %> <html> <body> <h1>Welcome</h1> <% # Bad practice: Logic in template if ($condition) { print "<p>Condition met</p>"; } %> </body> </html>
<% # Good practice: Keep logic out of template my $message = $condition ? "Condition met" : "Condition not met"; %> <html> <body> <h1>Welcome</h1> <p><%= $message %></p> </body> </html>

Template Toolkit web development pitfalls templating issues best practices