Writing CGI Applications with Perl is a start-to-finish guide to accomplishing key Web development tasks by fully using the power of Perl and CGI together. Using extensive examples, careful line-by-line explanations, and skill-stretching exercises, it not only provides useful cut-and-paste code: it also teaches the practical skills and techniques you'll need to build virtually any CGI-based application. Kevin Meltzer and Brent Michalski cover every key area of Web application development with Perl: database integration, form and file handling, security, e-mail, graphics, and more. The book's in-depth coverage includes: working with HTML Web forms and obtaining user input; placing cookies and tracking clicks; connecting to POP3 e-mail servers; embedding Perl in HTML using HTML::Mason; remote file management across the Web; creating dynamic images; and working with XML. The book also provides detailed explanations and examples of working with Perl DBI, as well as start-to-finish coverage of configuring and using the popular mod_perl Apache module. All of the sample code will be available at a companion web site.
Sprache
Verlagsort
Verlagsgruppe
Zielgruppe
Für höhere Schule und Studium
Maße
Höhe: 235 mm
Breite: 190 mm
Dicke: 30 mm
Gewicht
ISBN-13
978-0-201-71014-4 (9780201710144)
Copyright in bibliographic data and cover images is held by Nielsen Book Services Limited or by the publishers or by their respective licensors: all rights reserved.
Schweitzer Klassifikation
Kevin Meltzer has been using Perl since the early '90s for everything from CGI and system administration to database migrations and report generation. He considers himself a "Perl evangelist," and is the founder of the Hartford Perl Mongers (although he now resides in Florida). Kevin has been published in The Perl Journal, and is the judge of their annual Perl Poetry Contest. He is now working for Verio, Inc. as a Perl developer/engineer.
Brent Michalski discovered Perl around 1994 and has been programming in it ever since. He considers himself a "Perl freak" and loves sharing Perl with others. Brent mainly develops CGI applications because he enjoys the Web so much. He has written articles for Web Review, and currently maintains the Perl area on the Dr. Dobb's Journal Web site. Brent is a senior developer at MasterCard International where they let him play with Perl every day.
0201710145AB04062001
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