Writing CGI Applications with Perl

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. 网页表单入门。
简介。
表单标签。
使用CGI.pm读取表单输入。
使用户满意。
最后的示例。
用户练习。
程序列表。
5. 使用Cookie。
简介。
安全性。
限制。
Cookie的组成部分。
手动处理Cookie。
使用CGI.pm制作Cookie。
使用Cookie控制用户首选项。
用户练习。
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处理程序。
读者练习。
列表。