Beginning Perl Web Development

Beginning Perl Web Development

5319chFM.qxd 10/6/05 9:29 AM Page i Beginning Web Development with Perl From Novice to Professional Steve Suehring 5319chFM.qxd 10/6/05 9:29 AM Page ii Beginning Web Development with Perl: From Novice to Professional Copyright © 2006 by Steve Suehring All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN (pbk): 1-59059-531-9 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. Lead Editor: Ewan Buckingham Technical Reviewer: James Lee Editorial Board: Steve Anglin, Dan Appleman, Ewan Buckingham, Gary Cornell, Tony Davis, Jason Gilmore, Jonathan Hassell, Chris Mills, Dominic Shakeshaft, Jim Sumser Project Managers: Laura Cheu, Richard Dal Porto Copy Editors: Marilyn Smith, Nicole LeClerc Assistant Production Director: Kari Brooks-Copony Production Editor: Ellie Fountain Compositor: Kinetic Publishing Services, LLC Proofreader: Lori Bring Indexer: Rebecca Plunkett Cover Designer: Kurt Krames Manufacturing Director: Tom Debolski Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail [email protected], or visit http://www.springeronline.com. For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219, Berkeley, CA 94710. Phone 510-549-5930, fax 510-549-5939, e-mail [email protected], or visit http://www.apress.com. The information in this book is distributed on an “as is” basis, without warranty. Although every precau- tion has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. The source code for this book is available to readers at http://www.apress.com in the Source Code section. 5319chFM.qxd 10/6/05 9:29 AM Page iii Contents at a Glance About the Author . xiii About the Technical Reviewer. xv Acknowledgments . xvii Introduction. xix PART 1 ■ ■ ■ CGI Development with Perl ■CHAPTER 1 The CGI Module. 3 ■CHAPTER 2 Popular CGI Modules. 35 ■CHAPTER 3 Databases and Perl . 49 ■CHAPTER 4 System Interaction . 73 PART 2 ■ ■ ■ Internet Interaction with LWP and Net:: Tools ■CHAPTER 5 LWP Modules . 89 ■CHAPTER 6 Net:: Tools . 107 PART 3 ■ ■ ■ XML and RSS ■CHAPTER 7 SOAP-Based Web Services . 137 ■CHAPTER 8 Perl and RSS . 153 ■CHAPTER 9 XML Parsing with Perl . 165 PART 4 ■ ■ ■ Performance Enhancement with mod_perl ■CHAPTER 10 Apache and mod_perl . 183 ■CHAPTER 11 Development with mod_perl . 201 iii 5319chFM.qxd 10/6/05 9:29 AM Page iv PART 5 ■ ■ ■ Creating Web Templates ■CHAPTER 12 The Template Toolkit . 233 ■CHAPTER 13 Perl Web Sites with Mason. 263 ■APPENDIX Perl Basics . 283 ■INDEX . 339 iv 5319chFM.qxd 10/6/05 9:29 AM Page v Contents About the Author . xiii About the Technical Reviewer. xv Acknowledgments . xvii Introduction. xix PART 1 ■ ■ ■ CGI Development with Perl ■CHAPTER 1 The CGI Module . 3 An Overview of CGI . 3 What You Need for This Chapter . 4 Hello World, CGI Style . 5 Function-Oriented Hello World. 5 Object-Oriented Hello World. 9 A Closer Look at the CGI.pm Functions . 11 HTML Shortcuts . 11 Dynamic Pages and Forms. 12 Cookies . 15 Environment Variables . 23 Viewing Environment Variables . 23 Carrying Values Between Forms . 24 Interaction with the System. 26 Debugging and Troubleshooting . 27 Verbose Output. 28 Syntax Check . 28 The Carp Module . 29 Other Troubleshooting Tips. 31 Security Considerations with CGI Programs . 31 File Permissions . 32 Taint Mode . 32 Strictness . 33 Untrusted Data from Forms . 33 Untrusted Data from Cookies. 34 Summary . 34 v 5319chFM.qxd 10/6/05 9:29 AM Page vi vi ■CONTENTS ■CHAPTER 2 Popular CGI Modules. 35 Integration with Other Modules. 35 CGI::Carp . 35 URI::Escape. 39 Net::SMTP . 43 Mod_perl and HTML::Mason . 44 Interaction Based on Environment Variables. 45 Security Considerations with CGI Modules . 47 Summary . 47 ■CHAPTER 3 Databases and Perl . 49 Interacting with a Database. 49 The DBI . 49 Database Drivers . 50 Data Source Names, Credentials, and Attributes . 51 Database Handles . 52 Statement Handles . 53 Error Handling. ..

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    377 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us