Template Toolkit

openkk 13年前發布 | 17K 次閱讀 Perl 模板引擎

Template Toolkit 是一個快速、靈活和高可擴展的模板處理系統。可以用來處理各種規模的網頁

下面是 Perl 使用該工具的例子:

模板文件內容:

Dear [% name %],

It has come to our attention that your account is in 
arrears to the sum of [% debt %].

Please settle your account before [% deadline %] or we 
will be forced to revoke your Licence to Thrill.

The Management.
源程序:
use Template;

my $tt = Template->new({
    INCLUDE_PATH => '/usr/local/templates',
    INTERPOLATE  => 1,
}) || die "$Template::ERROR\n";

my $vars = {
    name     => 'Count Edward van Halen',
    debt     => '3 riffs and a solo',
    deadline => 'the next chorus',
};

$tt->process('letters/overdrawn', $vars)
    || die $tt->error(), "\n";

項目主頁:http://www.baiduhome.net/lib/view/home/1322984353531

 本文由用戶 openkk 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!