Brought to you by EarthWeb
IT Library Logo

Click Here!
Click Here!

Search the site:
 
EXPERT SEARCH -----
Programming Languages
Databases
Security
Web Services
Network Services
Middleware
Components
Operating Systems
User Interfaces
Groupware & Collaboration
Content Management
Productivity Applications
Hardware
Fun & Games

EarthWeb Direct EarthWeb Direct Fatbrain Auctions Support Source Answers

EarthWeb sites
Crossnodes
Datamation
Developer.com
DICE
EarthWeb.com
EarthWeb Direct
ERP Hub
Gamelan
GoCertify.com
HTMLGoodies
Intranet Journal
IT Knowledge
IT Library
JavaGoodies
JARS
JavaScripts.com
open source IT
RoadCoders
Y2K Info

Perl 5

      U N L E A S H E D




by Kamran Husain and Robert F. Breedlove




C  O  N  T  E  N  T  S



Introduction

Chapter 1  What is Perl?

Chapter 2  A Brief Introduction to Perl

Chapter 3  References

Chapter 4  Introduction to Perl Modules

Chapter 5  Object-Oriented Programming in Perl

Chapter 6  Binding Variables to Objects

Chapter 7  String and Patterns

Chapter 8  Documenting Perl Scripts

Chapter 9  Portability Issues with Windows and Perl

Chapter 10  Win32 Modules on Windows NT

Chapter 11  Security Issues in Perl

Chapter 12  Using Sockets

Chapter 13  Messaging Facilities: The System V Ipc Functions

Chapter 14  Signals, Pipes, FIFOs, and Perl

Chapter 15  Direct Access to System Facilities

Chapter 16  Command-line Interface with Perl

Chapter 17  GUI Interfaces with Perl/Tk

Chapter 18  Databases for Perl

Chapter 19  Generating Reports

Chapter 20  Introduction to Web Pages and CGI

Chapter 21  Building VRML Models with Perl

Chapter 22  Using HTML FORMs with Perl CGI Scripts

Chapter 23  HTML with Perl Modules

Chapter 24  Building and Installing the Perl 5 Interpreter

Chapter 25  Perl Internal Files and Structures

Chapter 26  Writing C Extensions in Perl

Chapter 27  Writing Extensions in C

Chapter 28  Client/Server Using Java Applets and Perl

Chapter 29  Practical Scripts While Using Perl

Chapter 30  Using the Perl Debugger

Chapter 31  Generating Code

Chapter 32  Dynamic Image Creation

Chapter 33  Debugging CGI Applications

appendix A  Perl 5 Function and Variable Reference

appendix B  Perl Module Archives 737



Credits




This book is dedicated to my parents: Dr. Saleha Bilal Husain and Dr. Bilal Riaz Husain. -KH
To my family, my wife Madeline for giving me the time and encouragement, and my children Delenn, Duncan, and Diego for setting my life in perspective. -BB



Copyright © 1996 by Sams Publishing

FIRST EDITION

All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher. No patent liability is assumed with respect to the use of the information contained herein. Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions. Neither is any liability assumed for damages resulting from the use of the information contained herein. For information, address Sams Publishing, 201 W. 103rd St., Indianapolis, IN 46290.

International Standard Book Number: 0-672-30891-6

HTML conversion by :
    M/s. LeafWriters (India) Pvt. Ltd.
    Website : http://leaf.stpn.soft.net
    e-mail : leafwriters@leaf.stpn.soft.net

All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Sams Publishing cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark.


PublisherRichard K. Swadley
Publishing Team Leader Greg Wiegand
Managing Editor Cindy Morrow
Director of Marketing John Pierce
Assistant Marketing Managers Kristina Perry, Rachel Wolfe


Acquisitions Editor Christopher Denny Development Editor Anthony Amico
Software Development Specialist Brad Myers Production Editors Kristi Hart, Katherine Ewing
Copy Editor Bart ReedIndexer Chris Barrick
Technical Reviewers Zachary Bir, John Fleming, Elliotte Harold, Scott Hutton, Matt Liggett, John Neinart Editorial Coordinator Bill Whitmer
Technical Edit Coordinator Lynette Quinn Editorial Assistants Carol Ackerman, Andi Richter, Rhonda Tinch-Mize
Cover Designer Tim AmrheinBook Designer Gary Adair
Copy Writer Peter FullerProduction Team Supervisor Brad Chinn
ProductionDebra Bolhuis, Mona Brown, Michael Dietsch, Jason Hand, Daniel Harris, Bill Hartman, Susan Knose, Clint Lahnen, Paula Lowell, Laura Robbins, Bobbi Satterfield, Susan Van Ness, Suzanne Whitmer


Acknowledgements

First of all, I would like to thank Chris Denny at Sams for giving me the opportunity to write a book on Perl 5. I would also to thank Kristi Hart, Tony Amico, and Bart Reed for their patience, help, advice, and forcing me to keep up with deadlines.

I'd like to thank Uzma, my wife, and Haya and Hana, my twin daughters, for putting up with my weird schedules and odd hours.

Last, but definitely not the least, thanks to all the Perl programmers on Perl mailing lists for all the critique and comments via e-mail.

Kamran Husain
1996

About the Authors

Kamran Husain is a software consultant specializing in developing real-time applications, data acquisition, and turn-key systems in all sorts of software environments including C++, Java, Windows NT and 95, JavaScript, and Motif. He can be reached via e-mail at khusain@ikra.com.

Robert F. Breedlove is a senior systems engineer with EDS. He has over 20 years of experience in data processing including extensive client/server, UNIX, intranet and Internet experience. He can be reached at breedlov@netcom.com, or at his homepage: http://www.channel1.com/users/rbreed01/.

Tell Us What You Think!

As a reader, you are the most important critic and commentator of our books. We value your opinion and want to know what we're doing right, what we could do better, what areas you'd like to see us publish in, and any other words of wisdom you're willing to pass our way. You can help us make strong books that meet your needs and give you the computer guidance you require.

Do you have access to CompuServe or the World Wide Web? Then check out our CompuServe forum by typing GO SAMS at any prompt. If you prefer the World Wide Web, check out our site at http://www.mcp.com.

Note
If you have a technical question about this book, call the technical support line at (800) 571-5840, ext. 3668.

As the team leader of the group that created this book, I welcome your comments. You can fax, e-mail, or write me directly to let me know what you did or didn't like about this book-as well as what we can do to make our books stronger. Here's the information:

FAX:317/581-4669
E-mail:programming_mgr@sams.mcp.com
Mail:Greg Wiegand
Comments Department
Sams Publishing
201 W. 103rd Street
Indianapolis, IN 46290


Introduction

This book documents a very powerful language called Perl 5, which is version 5 of Larry Wall's creation, Perl. Perl is fast becoming the de facto language for UNIX system administrators, Webmasters on the World Wide Web, and programmers who want a fast, powerful, and easy-to-use program language. This book will provide you with the basics of the language and introduce you to the tools available for Perl.

While writing this book, I assumed that you, the reader, have had some prior programming experience. If you do not have any prior programming experience, I strongly suggest not skipping the first three chapters. If you are already a programmer and are familiar with Perl 4, this book should provide you with enough knowledge to use the great new features.

How This Book Is Organized

This book is divided into six parts.

Part I: The Basics

The first part provides a brief introduction to Perl as a programming language. It covers the use of references to variables, regular expressions, and the fundamentals of programming in Perl by using modules. It introduces the use of Perl for programming with an object-oriented paradigm. It also covers the not-so-basic but very important topic of tying variables in Perl programs.

Part II: Communications

The second part covers applying Perl to different platforms and types of applications. It begins with a chapter on processing patterns and strings in Perl. For a long time, I debated reversing the order of Chapters 6 and 7