Table of Contents

perl database programming
Perl Database Programming
by Brent Michalski ISBN:0764549561
John Wiley & Sons © 2003 (552 pages)

Here is an in-depth guide to creating database-driven applications using Perl.

Table of Contents
Perl Database Programming
Preface
Part I - Perl and Database Fundamentals
Chapter 1 - Database Basics
Chapter 2 - Working with a Database
Chapter 3 - Working with Database Tables
Chapter 4 - Fetching Data from the Database (Basics)
Chapter 5 - Making Changes to Your Data
Part II - Advanced Database Programming
Chapter 6 - Web Database Programming
Chapter 7 - Fetching Data from the Database (Advanced)
Chapter 8 - Working with Binary (BLOB) Data
Chapter 9 - Session Management with Tied Hashes
Chapter 10 - Using Database Transactions
Part III - Perl and Web Services
Chapter 11 - Perl, XML, and Databases
Chapter 12 - Creating a SOAP-Based Catalog
Chapter 13 - Sending Automatic E-mail Reports
Part IV - Perl and General Web Programming
Chapter 14 - Creating a Phonebook
Chapter 15 - Creating a Web-Based Shopping Cart
Chapter 16 - Creating a Web-Based Photo Album
Appendix A - Configuring Your System
Appendix B - Common SQL Reference
Appendix C - MySQL Command Reference
Appendix D - DBI Reference
Index
List of Figures
List of Tables
List of Listings
List of Sidebars

perl database programming
Perl Database Programming
by Brent Michalski ISBN:0764549561
John Wiley & Sons © 2003 (552 pages)

Here is an in-depth guide to creating database-driven applications using Perl.

In this authoritative reference, Perl expert Brent Michalski uses plenty of examples to help you master Perl’s capabilities in database applications with MySQL, PostgreSQL, and Oracle. Along the way, he explores practical applications for cutting-edge technologies like XML and Web services. If you’re a Perl novice, the comprehensive code samples and step-by-step explanations will have your writing database applications quickly and confidently. If you’re experienced, this definitive guidebook has everything you need to move ahead with Web programming, problem tracking, automatic e-mail reports, and much more.

You’ll learn how to:

  • Understand different database models, DBIs, and DBDs
  • Set up relational databases, retrieve information, and generate reports
  • Tie a Perl hash to a database and track users with cookies
  • Generate and deliver automatic e-mail reports
  • Use tied hashes to create Web-based shopping carts
  • Handle binary data and submit BLOB data
  • Create phonebooks, photo albums, and a SOAP-based catalog

About the Author

Brent Michalski works with Perl on a daily basis in his job as a senior developer for MasterCard International. He is coauthor of Writing CGI Applications with Perl and has written articles for Web Review and the Perl Home Page. Currently, he maintains the Perl area of the Dr. Dobb’s Journal Web site.

Perl Database Programming

Brent Michalski

Published by
Wiley Publishing, Inc.
10475 Crosspoint Boulevard
Indianapolis, IN 46256
www.wiley.com

Copyright © 2003 by Wiley Publishing, Inc., Indianapolis, Indiana

Published simultaneously in Canada

ISBN: 0-7645-4956-1

Manufactured in the United States of America

10 9 8 7 6 5 4 3 2 1

1O/RY/RQ/QS/IN

No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 750-4744. Requests to the Publisher for permission should be addressed to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4447, E-Mail: permcoordinator@wiley.com.

LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: WHILE THE PUBLISHER AND AUTHOR HAVE USED THEIR BEST EFFORTS IN PREPARING THIS BOOK, THEY MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS BOOK AND SPECIFICALLY DISCLAIM ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES REPRESENTATIVES OR WRITTEN SALES MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR YOUR SITUATION. YOU SHOULD CONSULT WITH A PROFESSIONAL WHERE APPROPRIATE. NEITHER THE PUBLISHER NOR AUTHOR SHALL BE LIABLE FOR ANY LOSS OF PROFIT OR ANY OTHER COMMERCIAL DAMAGES, INCLUDING BUT NOT LIMITED TO SPECIAL, INCIDENTAL, CONSEQUENTIAL, OR OTHER DAMAGES.

For general information on our other products and services or to obtain technical support, please contact our Customer Care Department within the U.S. at (800) 762-2974, outside the U.S. at (317) 572-3993 or fax (317) 572-4002.

Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books.

Library of Congress Control Number: 2002107900

Trademarks: Wiley and related trade dress are registered trademarks of Wiley Publishing, Inc., in the United States and other countries, and may not be used without written permission. All other trademarks are the property of their respective owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book.

About the Author

Brent Michalski discovered Perl around 1994 while he was in the Air Force. There was no turning back from there, he became an avid 'Perl freak' and has been using it ever since. Brent mainly develops CGI applications because he really enjoys the Web. Brent has written articles for Web Review, Dr. Dobb's Journal online, O'Reilly, and others. Brent also enjoys teaching others about Perl. In his spare time, he loves playing ice hockey, where he plays the one-and-only 'real' position, goalie.

Credits

Executive Editor
Chris Webb

Acquisitions Editor
Grace Buechlein

Project Editor
Neil Romanosky

Technical Editor
Sean Burke

Copy Editor
C. M. Jones

Editorial Manager
Mary Beth Wakefield

Vice President & Executive Group Publisher
Richard Swadley

Vice President and Executive Publisher
Bob Ipsen

Executive Editorial Director
Mary Bednarek

Project Coordinator
Nancee Reeves

Graphics and Production Specialists
Beth Brooks, Melanie DesJardins, Joyce Haughey, Barry Offringa, Kathie Schutte

Quality Control Technicians
Laura Albert, John Greenough, Andy Hollandbeck

Proofreading and Indexing
TECHBOOKS Production Services

For my wife and kids-my world.

Acknowledgments

Writing this book was a huge undertaking, and I could not have done it without the support of many others. First off, I want to thank Jesus Christ, my savior, for giving me the knowledge and persistence to see that this book is finally a reality. My wife, Chris, and my kids, Luc, Rae, and Logan also had to give up a lot (of my time) for me to get this done. I can't thank them enough!

My tech editor Sean Burke also helped out tremendously. Sean is a very knowledgeable Perl programmer and author who wasn't afraid to let me know how he really felt.

Finally, the people of #perl on IRC were also a great help. People like kane, who helped me acquire the needed software to write this book, thanks kane! Then there is kudra, merlyn, Pudge, lucs, waltman, DrForr, DrMath, Spoon, acme, aevil, boojum, Screwtape, beeer, amagosa, shit, cwest, cogent, crab, dngor, freeside, geoffeg, mendel, darkuncle, Masque, ology, obra, pdcawley, petdance, Roderick, sheriff, Schuyler, sky, sungo, uri, rootbeer, chip, Zenham, {KM}. Yes, their names all sound strange, and I am sure that I have missed some (sorry if I did), but #perl was my 24-hour resource for answers when I needed them.

Dear Valued Customer,

We realize you're a busy professional with deadlines to hit. Whether your goal is to learn a new technology or solve a critical problem, we want to be there to lend you a hand. Our primary objective is to provide you with the insight and knowledge you need to stay atop the highly competitive and ever-changing technology industry.

Wiley Publishing, Inc., offers books on a wide variety of technical categories, including security, data warehousing, software development tools, and networking - everything you need to reach your peak. Regardless of your level of expertise, the Wiley family of books has you covered.

  • For Dummies - The fun and easy way to learn

  • The Weekend Crash Course -The fastest way to learn a new tool or technology

  • Visual - For those who prefer to learn a new topic visually

  • The Bible - The 100% comprehensive tutorial and reference

  • The Wiley Professional list - Practical and reliable resources for IT professionals

The book you hold now, Perl Database Programming, is the quintessential guide to building data-driven Web applications with Perl. Whether you have never created a data-driven application or are a Perl expert, Perl Database Programming is everything you need to build dynamic Web applications quickly and easily. Beginning with database fundamentals, Dr. Dobb's Journal Online Perl expert Brent Michalski guides you through generating reports with data, working with binary data, session management, database transactions, tied hashes, and even Web services. Not just another Perl book, Perl Database Programming is everything you need to take your Perl programming to the next level.

Our commitment to you does not end at the last page of this book. We'd want to open a dialog with you to see what other solutions we can provide. Please be sure to visit us at www.wiley.com/compbooks to review our complete title list and explore the other resources we offer. If you have a comment, suggestion, or any other inquiry, please locate the 'contact us' link at www.wiley.com.

Sincerely,

Richard K. Swadley
Vice President & Executive Group Publisher
Wiley Technology Publishing