Perl Template Toolkit (Paperback) (Perl 模板工具包 (平裝本))

Darren Chamberlain, Dave Cross, Andy Wardley

  • 出版商: O'Reilly
  • 出版日期: 2004-01-27
  • 定價: $1,360
  • 售價: 8.0$1,088
  • 語言: 英文
  • 頁數: 592
  • 裝訂: Paperback
  • ISBN: 0596004761
  • ISBN-13: 9780596004767
  • 相關分類: Perl 程式語言
  • 立即出貨(限量) (庫存=10)

買這商品的人也買了...

相關主題

商品描述

 

Summary

Among the many different approaches to "templating" with Perl--such as Embperl, Mason, HTML::Template, and hundreds of other lesser known systems--the Template Toolkit is widely recognized as one of the most versatile. Like other templating systems, the Template Toolkit allows programmers to embed Perl code and custom macros into HTML documents in order to create customized documents on the fly. But unlike the others, the Template Toolkit is as facile at producing HTML as it is at producing XML, PDF, or any other output format. And because it has its own simple templating language, templates can be written and edited by people who don't know Perl. In short, the Template Toolkit combines the best features of its competitors, with ease-of-use and flexibility, resulting in a technology that's fast, powerful and extensible, and ideally suited to the production and maintenance of web content and other dynamic document systems.

In Perl Template Toolkit you'll find detailed coverage of this increasingly popular technology. Written by core members of the technology's development team, the book guides you through the entire process of installing, configuring, using, and extending the Template Toolkit. It begins with a fast-paced but thorough tutorial on building web content with the Template Toolkit, and then walks you through generating and using data files, particularly with XML. It also provides detailed information on the Template Toolkit's modules, libraries, and tools in addition to a complete reference manual.

Topics in the book include:


  • Getting started with the template toolkit
  • The Template language
  • Template directives
  • Filters
  • Plugins
  • Extending the Template Toolkit
  • Accessing databases
  • XML
  • Advanced static web page techniques
  • Dynamic web content and web applications


The only book to cover this important tool, Perl Template Toolkit is essential reading for any Perl programmer who wants to create dynamic web content that is remarkably easy to maintain. This book is your surefire guide to implementing this fast, flexible, and powerful templating system.

Table of Contents

Preface

1. Getting Started with the Template Toolkit

     What the Template Toolkit Does

     The Templating Ecosystem

     Installing the Template Toolkit

     Documentation and Support

     Using the Template Toolkit

     The Template Toolkit Language

     Template Variables

     Template Directives

     Integrating and Extending the Template Toolkit

2. Building a Complete Web Site Using the Template Toolkit

     Getting Started

     Template Components

     Defining Variables

     Generating Many Pages

     Adding Headers and Footers Automatically

     More Template Components

     Wrapper and Layout Templates

     Menu Components

     Defining and Using Complex Data

     Assessment

3. The Template Language

     Template Syntax

     Template Variables

     Virtual Methods

4. Template Directives

     Accessing Variables

     Accessing External Templates and Files

     Defining Local Template Blocks

     Loops

     Conditionals

     Filters

     Plugins

     Macros

     Template Metadata

     Exception Handling

     Flow Control

     Debugging

     Perl Blocks

5. Filters

     Using Filters

     Standard Template Toolkit Filters

6. Plugins

     Using Plugins

     Standard Template Toolkit Plugins

7. Anatomy of the Template Toolkit

     Template Modules

     The Runtime Engine

     Module Interfaces

8. Extending the Template Toolkit

     Using and Implementing Noncore Components

     Creating Filters

     Creating Plugins

     Building a New Frontend

     Changing the Language

9. Accessing Databases

     Using the DBI Plugin

     Using Class::DBI

     Using DBIx::Table2Hash

10. XML

     Simple XML Processsing

     Creating XML Documents

     Processing RSS Files with XML.RSS

     Processing XML Documents with XML.DOM

     Processing XML Documents with XML.XPath

     Processing XML Documents with XML.LibXML

     Using Views to Transform XML Content

11. Advanced Static Web Page Techniques

     Getting Started

     Library Templates

     Content Templates

     Navigation Components

     Structuring Page Content

     Creating a New Skin

12. Dynamic Web Content and Web Applications

     CGI Scripts

     CGI Templates

     Apache and mod_perl

     A Complete Web Application

Appendix: Configuration Options

Index

商品描述(中文翻譯)

摘要

在Perl的“模板化”方法中,有許多不同的方法,例如Embperl、Mason、HTML::Template和其他許多較不知名的系統,而模板工具包(Template Toolkit)被廣泛認為是最多功能的其中之一。與其他模板系統一樣,模板工具包允許程序員將Perl代碼和自定義宏嵌入HTML文檔中,以便動態創建定制文檔。但與其他系統不同的是,模板工具包在生成HTML的同時也能輕鬆生成XML、PDF或任何其他輸出格式。並且由於它具有自己簡單的模板語言,不懂Perl的人也可以編寫和編輯模板。簡而言之,模板工具包結合了競爭對手的最佳功能,易於使用和靈活,使其成為快速、強大、可擴展的技術,非常適合用於網絡內容和其他動態文檔系統的製作和維護。

在《Perl模板工具包》中,您將找到對這種越來越受歡迎的技術的詳細介紹。本書由該技術開發團隊的核心成員撰寫,引導您完成安裝、配置、使用和擴展模板工具包的整個過程。它首先以快節奏但詳盡的教程介紹使用模板工具包構建網絡內容,然後引導您生成和使用數據文件,特別是XML。它還提供了有關模板工具包的模塊、庫和工具的詳細信息,以及完整的參考手冊。

本書的主題包括:

- 開始使用模板工具包
- 模板語言
- 模板指令
- 過濾器
- 插件
- 擴展模板工具包
- 訪問數據庫
- XML
- 高級靜態網頁技術
- 動態網絡內容和網絡應用程序

作為唯一一本涵蓋這一重要工具的書籍,《Perl模板工具包》是任何想要創建易於維護的動態網絡內容的Perl程序員的必讀之書。本書是實施這種快速、靈活和強大的模板系統的可靠指南。

目錄

前言

1. 開始使用模板工具包
- 模板工具包的功能
- 模板生態系統
- 安裝模板工具包
- 文檔和支持
- 使用模板工具包
- 模板工具包語言
- 模板變量
- 模板指令
- 整合和擴展模板工具包

2. 使用模板工具包構建完整網站
- 入門
- 模板組件
- 定義變量
- 生成多個頁面
- 自動添加標題和頁腳
- 更多模板組件
- 包裝器和佈局模板
- 菜單組件
- 定義和使用複雜數據
- 評估

3. 模板語言
- 模板語法
- 模板變量
- 模板過濾器
- 模板插件
- 模板工具包擴展

(以下省略)