Writing CGI Applications with Perl
暫譯: 使用 Perl 編寫 CGI 應用程式

Kevin Meltzer, Brent Michalski

  • 出版商: Addison Wesley
  • 出版日期: 2001-02-25
  • 售價: $1,400
  • 貴賓價: 9.5$1,330
  • 語言: 英文
  • 頁數: 560
  • 裝訂: Paperback
  • ISBN: 0201710145
  • ISBN-13: 9780201710144
  • 相關分類: Perl 程式語言
  • 立即出貨(限量) (庫存=1)

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

相關主題

商品描述


Description

Writing CGI Applications with Perl shows how to use Perl to accomplish the most vital tasks needed for today's online applications. The student benefits from the numerous examples, line-by-line code explanations, and skill-stretching exercises. This book not only provides useful cut-and-paste code for programs, but it also teaches practical skills and techniques that will enable the development of any kind of CGI-based Web application with Perl. There is introductory material provided for newcomers to CGI or Perl. Numerous appendices include handy references as well as a guide to Perl documentation. A companion Web site, http://www.perlcgi-book.com, contains the code for all the examples.

Back to Top


Table Of Contents

Foreword.
Preface.
Acknowledgments.
1. Perl, CGI, and this Book.
What Is Perl?
What Is CGI?
Why Perl Is Good for CGI.

About this Book.
Who Is this Book For?
Conventions Used in this Book.
Using perldoc.

Using the CPAN.

2. What You Should Know.
Prerequisites.
Editors.
File Permissions.
Basic Security Concerns.
Using -T.
Checking for Taintedness and Laundering Data.
Your PATH and -T.
Installing a Script.
Troubleshooting.
Caching.
The Expires HTTP Header.
Cache-Control HTTP Header.

Listings.

3. Using Your Environment.
Introduction to %ENV.
Adding to %ENV.
Form Input Primer.
Example Script: Visitor Log.
Example Script: Basic Report.
Reader Exercise.
What Have We Learned?
Listings.

4. Introduction to Web Forms.
Introduction.
Form Tags.
Reading Form Input with CGI.pm.
Making Your Users Happy.
Final Example.
User Exercises.
Program Listings.

5. Working with Cookies.
Introduction.
Security.
Limitations.
Cookie Pieces.
Working with Cookies the Manual Way.
Baking Cookies with CGI.pm.
Controlling User Preferences with Cookies.
User Exercises.

6. Access Counters.
Introduction.
Example Script: SSI Text Counter.
Example Script: SSI Image Counter.
Example Script: SSI Text Counter, with a Twist.
Example Script: An Imageless Image Counter.
Counter Conclusion.
Reader Exercises.
Listings.

7. Web-Based File Uploading.
Introduction.
File Uploading Basics.
Viewing Files.
Uploading Multiple Files.
Reader Exercises.
File Listings.

8. Tracking Clicks.
Introduction.
Example Script: A Simple Click Tracker.
Example Script: Random Images.
Example Script: Click Tracking (Reprise).
Reader Exercises.
Listings.

9. Using mod_perl.
What Is mod_perl?
Configuring mod_perl.
Apache::Registry.
Automatic Headers and Footers with Apache::Sandwich.
A mod_perl Photo Album with Apache::Album.
Authentication with Apache::AuthDBI.
Writing a mod_perl Handler.
Reader Exercises.
Listings.

10. Web-Based E-mail.
Introduction.
Example Script: Checking POP3 Mail via the Web.
Example Script: Reading E-mail via the Web.
Example Script: Displaying Attachments.
Example Script: Composing E-mail.
Reader Exercises.
Listings.

11. Introduction to DBI and Databases on the Web.
Introduction.
Using the Perl DBI.
Connecting to the Database.
Disconnecting from the Database.

Preparing and Executing an SQL Query.
Fetching Data.
The fetchall_arrayref( ) Method.
The fetchrow_arrayref( ) Method.
The fetchrow_hashref( ) Method.
The bind_columns( ) Method.

Putting It All Together.
The do( ) Method.
Wrapping It Up.

Reader Exercises.
Listings.

12. Tied Variables.
Introduction.
Setting It All Up.
Getting Started.
Diving In.
The Main Program.
Finishing the ShopCart Module.
Running the Program.
Wrapping It Up.
Program Listings.

13. Embedding Perl in HTML with Mason.
Introduction.
Installation.
The Strategy.
Mason Syntax.
Special Mason Components.
Cascading Execution.
Moving Right Along.
rss2html.
my_news.
footer.
Wrapping It Up: The Code for the Example Site.

14. Document Management via the Web.
Introduction.
The Plan.
auth.cgi.
shared.pl.
main.cgi.
upload.cgi.
viewer.cgi.
Program Listings.

15. Dynamically Manipulating Images.
Introduction.
Adding Shapes and Text.
Creating a Dynamic Graph.
Creating Thumbnail Images.
Filtering Images with Image::Magick.
Animated Images.
Reader Exercises.
Listings.

16. RSS And XML.
XML and RSS Overview.
Structure of an XML Document.

News Portals with RSS.
A Home Page News Portal.

Creating an RSS File.
Reader Exercises.
Listings.

Appendix A. Server Codes.
Provide confirmation that a request is being processed.
Request was performed.
Request not performed.
Request is incomplete.
Internal server errors.

Appendix B. Environment Variables.
Appendix C. POSIX::strftime( ) Formats.
Appendix D. General Public License.
Appendix E. Artistic License.
Appendix F. Perl Documentation.
Appendix G. ASCII Codes.
Appendix H. Special HTML Characters.
Resources.
Index. 0201710145T04062001


Back to Top

商品描述(中文翻譯)

描述
《使用 Perl 編寫 CGI 應用程式》展示了如何使用 Perl 完成當今在線應用程式所需的最重要任務。學生可以從眾多範例、逐行代碼解釋和技能挑戰練習中受益。本書不僅提供有用的可複製代碼,還教授實用的技能和技術,使讀者能夠使用 Perl 開發各種基於 CGI 的 Web 應用程式。書中為 CGI 或 Perl 的新手提供了入門材料。許多附錄包括方便的參考資料以及 Perl 文檔的指南。伴隨的網站 http://www.perlcgi-book.com 包含所有範例的代碼。

目錄
前言
序言
致謝
1. Perl、CGI 與本書
什麼是 Perl?
什麼是 CGI?
為什麼 Perl 適合 CGI。
關於本書。
本書的讀者對象是誰?
本書中使用的約定。
使用 perldoc。
使用 CPAN。
2. 你應該知道的
先決條件。
編輯器。
檔案權限。
基本安全問題。
使用 -T。
檢查污染性和清洗數據。
你的 PATH 和 -T。
安裝腳本。
故障排除。
快取。
Expires HTTP 標頭。
Cache-Control HTTP 標頭。
列表。
3. 使用你的環境
%ENV 介紹。
向 %ENV 添加內容。
表單輸入入門。
範例腳本:訪客日誌。
範例腳本:基本報告。
讀者練習。
我們學到了什麼?
列表。
4. Web 表單介紹
介紹。
表單標籤。
使用 CGI.pm 讀取表單輸入。
讓你的用戶滿意。
最終範例。
用戶練習。
程式列表。
5. 操作 Cookies
介紹。
安全性。
限制。
Cookie 組件。
手動操作 Cookies。
使用 CGI.pm 創建 Cookies。
使用 Cookies 控制用戶偏好。
用戶練習。
6. 訪問計數器
介紹。
範例腳本:SSI 文本計數器。
範例腳本:SSI 圖像計數器。
範例腳本:帶有變化的 SSI 文本計數器。
範例腳本:無圖像計數器。
計數器結論。
讀者練習。
列表。
7. 基於 Web 的檔案上傳
介紹。
檔案上傳基礎。
查看檔案。
上傳多個檔案。
讀者練習。
檔案列表。
8. 點擊追蹤
介紹。
範例腳本:簡單的點擊追蹤器。
範例腳本:隨機圖像。
範例腳本:點擊追蹤(重溫)。
讀者練習。
列表。
9. 使用 mod_perl
什麼是 mod_perl?
配置 mod_perl。
Apache::Registry。
使用 Apache::Sandwich 自動添加標頭和頁尾。
使用 Apache::Album 創建 mod_perl 照片專輯。
使用 Apache::AuthDBI 進行身份驗證。
編寫 mod_perl 處理程序。
讀者練習。
列表。
10. 基於 Web 的電子郵件
介紹。
範例腳本:通過 Web 檢查 POP3 郵件。
範例腳本:通過 Web 閱讀電子郵件。
範例腳本:顯示附件。
範例腳本:撰寫電子郵件。
讀者練習。
列表。
11. DBI 和 Web 上的數據庫介紹
介紹。
使用 Perl DBI。
連接到數據庫。
斷開與數據庫的連接。
準備和執行 SQL 查詢。
獲取數據。
fetchall_arrayref( ) 方法。
fetchrow_arrayref( ) 方法。
fetchrow_hashref( ) 方法。
bind_columns( ) 方法。
將所有內容整合在一起。
do( ) 方法。
總結。
讀者練習。
列表。
12. 綁定變數
介紹。
設置所有內容。
開始。
深入。
主程序。
完成 ShopCart 模組。
運行程序。
總結。
程式列表。
13. 使用 Mason 在 HTML 中嵌入 Perl
介紹。
安裝。
策略。
Mason 語法。
特殊的 Mason 組件。
層疊執行。
繼續前進。
rss2html。
my_news。
footer。
總結:範例網站的代碼。
14. 通過 Web 進行文檔管理
介紹。
計劃。
auth.cgi。
shared.pl。
main.cgi。
upload.cgi。
viewer.cgi。
程式列表。
15. 動態操作圖像
介紹。
添加形狀和文本。
創建動態圖表。
創建縮略圖。
使用 Image::Magick 過濾圖像。
動畫圖像。
讀者練習。
列表。
16. RSS 和 XML
XML 和 RSS 概述。
XML 文檔的結構。
使用 RSS 的新聞門戶。
首頁新聞門戶。
創建 RSS 文件。
讀者練習。
列表。
附錄 A. 伺服器代碼
提供請求正在處理的確認。
請求已執行。
請求未執行。
請求不完整。
內部伺服器錯誤。
附錄 B. 環境變數
附錄 C. POSIX::strftime( ) 格式
附錄 D. 一般公共許可證
附錄 E. 藝術許可證
附錄 F. Perl 文檔
附錄 G. ASCII 代碼
附錄 H. 特殊 HTML 字符
資源
索引