;-_=_Scrolldown to the Underground_=_-; Perl in a Nutshell http://kickme.to/tiger/ By Ellen Siever, Stephen Spainhour & Nathan Patwardhan; ISBN 1-56592-286-7, 674 pages. First Edition, December 1998. (See the catalog page for this book.) Search the text of Perl in a Nutshell. Index Symbols | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z Table of Contents Preface Part I: Getting Started Chapter 1: Introduction to Perl Chapter 2: Installing Perl Part II: Language Basics Chapter 3: The Perl Interpreter Chapter 4: The Perl Language Chapter 5: Function Reference Chapter 6: Debugging Part III: Modules Chapter 7: Packages, Modules, and Objects Chapter 8: Standard Modules Part IV: CGI Chapter 9: CGI Overview Chapter 10: The CGI.pm Module Chapter 11: Web Server Programming with mod_perl Part V: Databases Chapter 12: Databases and Perl Part VI: Network Programming Chapter 13: Sockets Chapter 14: Email Connectivity Chapter 15: Usenet News Chapter 16: FTP Chapter 17: The LWP Library Part VII: Perl/Tk Chapter 18: Perl/Tk Part VIII: Win32 Chapter 19: Win32 Modules and Extensions Chapter 20: PerlScript Copyright © 1999 O'Reilly & Associates. All Rights Reserved. Preface Preface Contents: How This Book Is Organized Typographical Conventions How to Contact Us Acknowledgments Perl is a programming language that is useful. By this, we mean that people don't learn Perl just because they think they should, they learn Perl because they want to get something done. This book is for Perl programmers who need to get things done. It's for readers who have dabbled a little in Perl and want a single reference for all their needs. This book is part reference, part guide to the world of Perl. We cover the language itself, but also the Perl modules that are most popular - modules for CGI, database manipulation, network programming, graphical interfaces, and Win32 integration. How This Book Is Organized This book has eight parts, as follows: Part I, Getting Started Chapter 1, Introduction to Perl, gets you oriented to Perl and the Perl community. Chapter 2, Installing Perl, gives you some pointers on getting Perl and its modules installed on your machine. This chapter introduces you to the CPAN archive and discusses using the CPAN module to retrieve the latest versions of Perl modules. Part II, Language Basics Chapter 3, The Perl Interpreter, is about using the perl program itself. It covers environment variables, command-line options, and the differences in executing the Unix and Win32 versions of Perl. Chapter 4, The Perl Language, is the turbo-charged tutorial/reference to the Perl language. If you've never programmed before, then you might need a tutorial that goes more slowly. But if you have some experience with other programming languages, this chapter should teach you enough to start writing Perl programs. Chapter 5, Function Reference, is a reference chapter for each of the built-in functions to Perl. Chapter 6, Debugging, is about using the Perl debugger to help locate the rare errors in your programs. Part III, Modules Chapter 7, Packages, Modules, and Objects, gives a quick introduction to Perl packages, Perl modules, and object-oriented programming in Perl. Chapter 8, Standard Modules, is a reference to each of the modules included in the standard Perl distribution. Part IV, CGI Chapter 9, CGI Overview, is a brief introduction to the concepts behind CGI programming. Chapter 10, The CGI.pm Module, covers the very popular CGI.pm module, which is deemed essential by many CGI programmers. Chapter 11, Web Server Programming with mod_perl, is about mod_perl, the Apache module that can be used to significantly improve CGI performance and also allows you to embed Perl code into the Apache server itself. Part V, Databases Chapter 12, Databases and Perl, gives a brief introduction to DBM databases in Perl, and provides a reference to DBI, the Database Independence package that gives you a consistent interface to many different database packages. Part VI, Network Programming Chapter 13, Sockets, explains socket programming and how to use the IO:Socket module. Chapter 14, Email Connectivity, covers the Net::SMTP and Net::POP3 modules for sending and reading email, and also the Mail modules for manipulating email messages. Chapter 15, Usenet News, explains the NNTP protocol and the Net::NNTP module for reading and posting Usenet news, and the News::Newsrc module for managing .newsrc files. Chapter 16, FTP, explains the FTP protocol, the Net::FTP module for transferring files by FTP, and the Net::Netrc module for managing .netrc files. Chapter 17, The LWP Library, covers the most commonly used parts of the huge LWP library of modules for HTTP transactions. Part VII, Perl/Tk Chapter 18, Perl/Tk, is a reference to the Tk extension to Perl, for creating graphical user interfaces from within a Perl program. Part VIII, Win32 Chapter 19, Win32 Modules and Extensions, talks about the many Perl modules for working with the Win32 operating systems. Chapter 20, PerlScript, is about the ActiveX scripting tool, which is loosely based on Perl. Typographical Conventions [ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl Programming | Perl Cookbook ] Preface Typographical Conventions Italics are used for filenames, program names, URLs, command-line options, email addresses, replaceable text in syntax lines, and to introduce new terms. Letter Gothic is used for code snippets, method and function names, text to be typed literally, variables, constants, mail headers, and configuration directives. Letter Gothic italics are used for replaceable items in code examples. How This Book Is Organized How to Contact Us [ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl Programming | Perl Cookbook ] Preface How to Contact Us We have tested and verified the information in this book to the best of our ability, but you may find that features have changed (or even that we have made mistakes!). Please let us know about any errors you find, as well as your suggestions for future editions, by writing to: O'Reilly & Associates, Inc. 101 Morris Street Sebastopol, CA 95472 1-800-998-9938 (in the U.S. or Canada) 1-707-829-0515 (international/local) 1-707-829-0104 (FAX) You can also send us messages electronically. To be put on the mailing list or request a catalog, send email to: info@oreilly.com To ask technical questions or comment on the book, send email to: bookquestions@oreilly.com We have a web site for the book, where we'll list errata and any plans for future editions. You can access this page at: http://www.oreilly.com/catalog/perlnut/ Typographical Conventions Acknowledgments [ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl Programming | Perl Cookbook ] Preface Acknowledgments Many thanks to everyone who helped out on this book. Thanks to Larry Wall, Randal Schwartz, Tom Christiansen, and Sriram Srinivasan for their excellent books on Perl. Some material in this book is adapted from theirs; for that, we are very grateful. Thanks also to all the reviewers of this book, who include Randal Schwartz, Tom Christiansen, Graham Barr, Clinton Wong, and Erik Olson. Without their help, this book wouldn't be nearly as helpful as it is. We'd like to thank Linda Mui, our editor, and Val Quercia, who kept us on track, for all their support. Finally, since this book shares the camel image with Programming Perl, it occurs to us that someone might confuse it with the True Camel. So let's try to nip that in the bud: if you insist on giving this book a cute animal-related nickname, we encourage you to call it the "Camel head" or "Camel nut" or something else that makes the difference clear. How to Contact Us I. Getting Started [ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl Programming | Perl Cookbook ] Part I Part I: Getting Started Chapter 1: Introduction to Perl Chapter 2: Installing Perl Acknowledgments 1. Introduction to Perl [ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl Programming | Perl Cookbook ] [...]... chapter talks about installing modules.) Click on doc for Perl documentation, FAQs, etc 2.1 The CPAN Architecture 2.3 Installing Perl [ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl Programming | Perl Cookbook ] Chapter 2 Installing Perl 2.3 Installing Perl Most likely your system administrator is responsible for installing and upgrading... FAQ has transcended into a general-purpose starting point for learning anything about Perl The FAQ is distributed in several different formats, including HTML, PostScript, and plain ASCII text You can find the FAQ at several places: q The main source is located at http://www .perl. com /perl/ faq/ q On CPAN, you can find it in /CPAN/doc/FAQs/FAQ/ (See Chapter 2 for more information on CPAN.) q On a semi-regular... Programming with Perl, and CGI Programming with Perl See http://www .perl. com/ for an archive of reviews of Perl- related books 1.3 Which Platforms Support Perl? 2 Installing Perl [ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl Programming | Perl Cookbook ] Chapter 2 2 Installing Perl Contents: The CPAN Architecture How Is CPAN Organized? Installing... 5.005, you can now use MakeMaker to install the modules, or you can use the Perl Package Manager that comes with ActivePerl 2.4.3.1 Using MakeMaker To install a module using MakeMaker, follow the procedure described earlier for installing when you are running the standard distribution, replacing make with nmake or dmake as appropriate 2.4.3.2 Using the Perl Package Manager The Perl Package Manager (PPM)... of Perl are quite stable, and as of Perl 5.005, are integrated wholly with core Perl MacPerl integration is expected with Perl 5.006 1.2 Perl Development 1.4 Perl Resources [ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl Programming | Perl Cookbook ] Chapter 1 Introduction to Perl 1.4 Perl Resources Paradoxically, the way in which Perl. .. for a particular command install packages Installs the specified packages quit Leaves the Perl Package Manager remove packages Removes the specified packages from the system search Searches for information about available packages set Sets or displays current options verify Verifies that your current installation is up-to-date 2.4.4 Installing Modules with the CPAN Module If you are just getting and installing... more information 1.4 Perl Resources 2.2 How Is CPAN Organized? [ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl Programming | Perl Cookbook ] Chapter 2 Installing Perl 2.2 How Is CPAN Organized? CPAN materials are grouped into categories, including Perl modules, distributions, documentation, announcements, ports, scripts, and contributing authors... implement them may be missing on Windows 95, or bugs in Windows 95 may prevent them from working correctly 2.2 How Is CPAN Organized? 2.4 Getting and Installing Modules [ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl Programming | Perl Cookbook ] Chapter 2 Installing Perl 2.4 Getting and Installing Modules As you'll see when you look at the lists... general, FAQs are written and maintained on a volunteer basis by dedicated (and generous) members of the community The comp.lang .perl. misc FAQ (also known as the Perl FAQ) is maintained by Tom Christiansen and Nathan Torkington The Perl FAQ was created to minimize traffic on the comp.lang .perl. misc newsgroup, when it became clear that the same questions were being asked over and over again However, the FAQ... Programming Perl is also known as the Pink Camel, because of the color of the spine The second edition is known as the Blue Camel, and is written by Larry Wall, Tom Christiansen, and Randal Schwartz Other Perl books published by O'Reilly & Associates are Learning Perl ("The Llama"), Advanced Perl Programming, Perl Cookbook, Managing Regular Expressions, Learning Perl on Win32 Systems, Learning Perl/ Tk, . comp.lang .perl. misc FAQ, there are also several niche FAQs that are Perl- related. They are: Perl CGI Programming FAQ http://www .perl. com/CPAN-local/doc/FAQs/cgi /perl- cgi-faq.html Perl/ TK FAQ http://w4.lns.cornell.edu/~pvhp/ptk/ptkTOC.html Perl. it became clear that the same questions were being asked over and over again. However, the FAQ has transcended into a general-purpose starting point for learning anything about Perl. The FAQ is. Perl code into the Apache server itself. Part V, Databases Chapter 12, Databases and Perl, gives a brief introduction to DBM databases in Perl, and provides a reference to DBI, the Database Independence