in reply to Template Toolkit "Pre-Processor"

Most likely you can do this with the World's Simplest Templating Engine:

use File::Slurp 'read_file'; my $template = read_file($template_name); 1 while $template =~ s/\[%\s*INCLUDE\s(.*?)\s*%\]/read_file($1)/msge; print $template;

This will not handle include parameters and will not search different directories, but you can add that by replacing read_file by a subroutine more suited to your needs.

Update: Corrected regular expression according to pc88mxer's comment

Replies are listed 'Best First'.
Re^2: Template Toolkit "Pre-Processor"
by pc88mxer (Vicar) on Feb 29, 2008 at 15:51 UTC
    A little nit... wouldn't you want (.*?) for $1?