About halfway down the code:
sub ProcessTemplateText {
local($text) = @_;
$oldtext = $_;
$_= $text;
# Truly frightening stuff
s/\[eval (.*?) EVALEOF\]/eval $1/geo;
$outtext=$_;
$_ =$oldtext;
return $outtext;
}