in reply to Template Modules in Core
or just plain old string interpolation:# load values into %config, template into $string, then... 1 while $string =~ s/\[%\s*(\S+)\s*%\]/$config{$1}/;
Basically, if you just have to substitute in some variables, it's not worth using a fancy framework. If you have to do more, you won't find any module to help you in core Perl.# load values into e.g. $CONFIG::variable1, etc., then... $string = eval "package CONFIG;\n<<END_TEMPLATE;\n".$string."\nEND_TEM +PLATE\n";
|
---|