http://www.perlmonks.org?node_id=572471


in reply to The history of a templating engine

First of all, I finally fixed the bug with the <% q; %> syntax. I spent about a day mulling over it and trying to think about how to fix it with a fancy parser or something, but wasn't convinced I could catch all cases. Instead, I opted to wrap up everything in those tags inside an anonymous subroutine, execute it, and display the results. This naturally takes advantage of perl's functions not requiring the "return" keyword.

Maybe I misunderstood, but this looks like your templates will spend lots of time calling those anonymous subroutines, whould not

<% some; code; y %> => print OUT do {some; code; y};
suffice?