TemplateToolkit是一个快速、灵活和高可扩展的模板处理系统。可以用来处理各种规模的网页
下面是Perl使用该工具的例子:
模板文件内容:
Dear[%name%],Ithascometoourattentionthatyouraccountisinarrearstothesumof[%debt%].Pleasesettleyouraccountbefore[%deadline%]orwewillbeforcedtorevokeyourLicencetoThrill.TheManagement.源程序:
useTemplate;my$tt=Template->new({INCLUDE_PATH=>'/usr/local/templates',INTERPOLATE=>1,})||die"$Template::ERROR\n";my$vars={name=>'CountEdwardvanHalen',debt=>'3riffsandasolo',deadline=>'thenextchorus',};$tt->process('letters/overdrawn',$vars)||die$tt->error(),"\n";
评论