Utilities Guide: Chapter 1Welcome to the Perl Resource Kit
The Perl Resource Kit, UNIX Edition, aims to be the ultimate companion to Perl--a scripting language written by Larry Wall, assisted by a cast of thousands. Perl brings together the best features of C, the Bourne Shell, and data manipulation utilities such as sed and awk. Its popularity and wide acceptance owes to the fact that you can master the core features quickly, and Perl's smooth learning curve means that you can learn as you go. You will often find that you learn more as your needs increase. As muscles tend to grow with use, so does your Perl knowledge. Although one of Perl's strongest areas is processing text, it excels in other areas, such as system management, database access, and CGI development. You can also use it for graphical development, and it makes a great tool for quickly prototyping a system. Perhaps you bought the Perl Resource Kit because you thought it would help you squeeze more power out of a language you already know well. Perhaps you were looking to get deeper insights into some of the hundreds of modules that are available for Perl. Maybe you just bought this because you couldn't bear to leave another Perl-related product stranded on the bookshelves of your favorite bookseller. Whatever your intentions for obtaining this kit were, I'm sure they were noble. To reward such pure motives, the Perl Resource Kit is going to do its best to meet your expectations. Above all, the culture that surrounds Perl is very good at documenting its accomplishments. The abundance of online documentation is well-written, concise, and often delightfully up-to-date. However, there are a lot of choices available when you are attacking a project with Perl as your weapon. The hundreds of modules that are available can be quite overwhelming. Some modules overlap in very subtle ways, so it is not always easy to pick the right one without turning to sources of wisdom. Further, if you've come up against a programming problem that has not been addressed by one of these modules, what do you do when you need to code the solution yourself? This is where the Perl Resource Kit comes in handy. The books that comprise it address these issues nicely. Programming with Perl Modules provides a tutorial introduction to using the most important Perl modules. This book also includes a chapter titled "Contributing to CPAN," which guides you in creating and deploying your own modules. The two-volume Perl Module Reference supplies complete documentation and reference for nearly 600 key Perl modules. This book, the Perl Utilities Guide, supplies instructions for installing the software on the CD-ROM and for installing modules both from the CD-ROM and from remote archive sites. Additionally, the Utilities Guide offers coverage of JPL, a Java/Perl interface written by Larry Wall. JPL allows you to create hybrid Java and Perl programs, leveraging the power of Perl for tasks such as network connectivity and string processing, while making the most of Java's graphical capabilities. JPL is available nowhere else but the Perl Resource Kit. JPL is included on the Resource Kit's CD-ROM along with other useful tools, information, and samples. What Comes with the Resource Kit?The Perl Resource Kit includes a CD-ROM filled with software and reference material. The material on the CD-ROM complements the four books included in the kit. To help you find your way around the Resource Kit, the following roadmap provides brief descriptions of the books and CD-ROM contents.JPLJPL is a Java/Perl interface written by Larry Wall exclusively for the Perl Resource Kit. JPL is not necessarily an acronym, but the J stands for Java, and the PL comes from .pl, a common file extension used for Perl scripts. JPL allows you to easily embed Perl within Java applications and provides the "glue" between the two languages. Using JPL, you can write embedded Perl methods that manipulate Java objects and primitive data types. Perl methods can accept Java objects and primitive values as arguments, and can also return objects and values to Java methods.JPL can be used to build graphically rich, network-enabled applications that take advantage of the strengths of both languages. A number of example programs that showcase the wide possibilities available with JPL are developed in the Perl Utilities Guide. Many of these examples are included on the CD-ROM for you to use in your own JPL applications. Chapters 3 and 4 of this book cover the basic techniques of using JPL and walk through the examples. The Graphical Setup ToolThe graphical setup tool lets you easily install the contents of the CD-ROM. It offers options to install a binary version of Perl and/or the source code for Perl, as well as the utilities and examples included with the Resource Kit. The setup tool also includes a facility for managing and installing unbundled Perl modules, which offers the ability to install modules from the CD as well as from remote archive sites. The remote retrieval capability makes it easy to ensure that the modules you have locally are the most current versions available.CPAN MirrorThe Perl Resource Kit CD-ROM includes a mirror of CPAN (the Comprehensive Perl Archive Network). In the words of the CPAN welcome page, "CPAN aims to be The Perl archive, the only Perl archive you will ever need by definition: the C in CPAN obliges." In addition to the most recent Perl source code (as well as older versions), CPAN includes a vast collection of Perl modules. A module is a freely redistributable chunk of reusable code that can be easily imported into your Perl programs. In general, these modules are extremely easy to use, and often very well-documented. The graphical setup tool lets you search and copy modules from the CPAN mirror on the CD as well as from remote archive sites.Programming with Perl ModulesProgramming with Perl Modules includes an introduction to Perl modules, and tutorials for a number of the most popular and powerful modules. Building-block libraries, such asgetopts, which allows you to parse command-line options are showcased, as well as high-level modules, such as GD, which offers you the ability to generate GIF images. In addition, Programming with Perl Modules includes tutorial coverage of database, network, and web modules,
which exposes you to the fundamental building blocks of a web-based business solution. This book is an indispensable handbook for learning how to develop your own applications with Perl modules.Perl Module Reference (Two Volumes)The Perl Module Reference is a two-volume set that contains documentation for nearly 600 of the most popular Perl modules, organized by the same module categories used on CPAN itself. Not only will this reference enable you to find documentation on a module that you are using, but having the documentation available will help you decide if a given module is the right tool for the job before you install it.Perl Utilities GuideThis book, the Perl Utilities Guide, provides step-by-step instructions on getting the most out of the CD-ROM. The graphical setup tool, which is available for Solaris and Linux users, is explained in detail. Also, this book explains how to build from source and install modules from the CD-ROM for users who cannot or who do not wish to use the graphical setup tool. And that's just Chapter 2!The rest of the Utilities Guide is a comprehensive how-to and reference guide for building applets and applications that make use of JPL. Graphically rich sample programs give you hands-on practice using examples of some of the things that Perl is great for: data manipulation and network programming. How Can I Use the Resource Kit?Perl has been called the glue of the Internet. It's used in many places to connect applications to one another and has found one (among many) major niche: generating dynamic content for web sites. Of course, Perl is there for you when you have a multi-megabyte file that needs to be parsed, filed, sorted, indexed, briefed, debriefed, or numbered. So what can this resource kit do for you?
What You Should Know (And Where to Learn More)The Perl Resource Kit does not attempt to provide an introduction to Perl programming. Instead, it's a collection of tools that enables you to build on a solid foundation of mid-level Perl experience. If you're still using Perl 4.036 (or a much earlier version), you'll need to upgrade to the latest version to make use of the most current tools, including this Resource Kit. Fortunately, the Resource Kit includes the newest version of Perl. Here we cover some of the basic topics you should know as well as some background on resources for more information.Basic Concepts and Features of PerlTo make the most efficient use of this Kit, you should have experience with some of the following areas of Perl programming. This information is a distillation of some of the features listed on theperl manpage, and is a list of features that are fundamental to understanding what goes into a module:
CPAN HistoryCPAN began as an idea offered by Jared Rhine to the perl-packrats mailing list on December 6, 1993. This message arrived on the mailing list only four days after the mailing list was created, at a time when the list's membership could have been counted on the fingers of two hands. The packrats had been discussing a strategy for archiving Perl sources in the wake of the accidental deletion of the Coombs archive, which was one of the leading archives of Perl scripts at the time. Jared's proposal suggested that this "comprehensive Perl archive" follow the structure of the CTAN project, "a collection of canonical sites for TeX."
One day after Jared's message was forwarded to the packrats list, Coombs was officially declared to be "no more a Perl archive." That very day, Bill Middleton sent a missive to the caretakers of the CTAN, seeking advice on creating and maintaining such an archive. Although a top-level organization of the CPAN was discussed, the idea slumbered until February 19, 1995, when Jarkko Hietaniemi posted a message, titled "CPAN idea still alive?" to the packrats mailing list. By June 5, after much discussion
of how the CPAN should be organized, Jarkko announced a first cut of CPAN, which was located at On August 17, 1995, Andreas Koenig suggested an organization of the modules that led to the current organization of CPAN. The Perl 5 Module list, a master list of all freely available Perl modules, included a code for each author's name. Andreas suggested that the organization of the CPAN follow these author's names; one directory for each author, and all of that author's modules would be stored in the directory. On September 27, 1995, Andreas consolidated suggestions for CPAN's organization. Tim Bunce, then the maintainer of the Perl 5 Module List, suggested that the module categories in the module list be preserved, and this became the modules/by-category directory. The by-module directory was also adopted, and the by-author directory was chosen as the place where files would actually reside. The by-category and by-module directory contained symbolic links to the files in the by-author directory. This is the CPAN as it is known today; a massive (over 200 megabytes), distributed (mirrored by over 50 sites), well-organized archive of Perl materials. CPAN is accessible from the Tom Christiansen's perl.com multiplexor, at http://www.perl.com/CPAN. CPAN OrganizationThe files in CPAN are organized in several ways. You can choose to browse CPAN by the module name, the author's name, or by the module category. Also, search engines are available that let you perform queries on the hundreds of modules available at CPAN. Finally, the Perl 5 Modules List is a widely available document that contains a list of all CPAN modules, as well as information about installing and using the modules. The Perl 5 Modules List is posted regularly to comp.lang.perl.announce. The Perl Resource Kit includes a CD-ROM with a complete copy of CPAN--thus, you can browse it or you can use the graphical setup tool (see Chapter 2) to locate and install modules.You'll probably find browsing by module name and category to be the most useful. Browsing by module name is handy if you have become familiar with the modules that are available. Since related modules are often organized under the same package, if you are looking for something HTML-related, you'll probably browse within the directory set aside for HTML modules. Also, the module categories are organized at a very high level into more than twenty different groups. Browsing by module category can be very handy if you are not familiar with the available modules, or if you simply can't find the module you are looking for when you look in the usual places. Imagine that you need to develop a script that retrieves email messages from a POP3 server. Of course, you'll write this script in Perl, there's no question about that. But you need to find a module that will help you interact with that POP3 server. Knowing that CPAN is the standard repository of all wisdom and knowledge, you truck on over to CPAN, using the URL: When you bring up the directory listing, you find one directory that catches your eye, 19_Mail_and_Usenet_News. Following that link, you find a directory known as Mail. Lo and behold, the Mail directory contains a module called POP3Client, which does exactly what you want!Suppose now, three months later, you need to write a script that manipulates mail folders. Well, you remembered that the Mail module directory contained lots of neat stuff, so you head back to CPAN, but this time, you go directly to the Mail module directory with: Once you arrive at the Mail module directory, you find a package called MailFolder, which does exactly what you want. Of course, not all stories have such happy endings. Some end with you having to write the module you need, which can be a source of happiness in and of itself. In such cases, you'll find Programming with Perl Modules in this resource kit to be indispensable. What If I Need Help?If you can't find what you are looking for in the Resource Kit, your first point of outside help should be the Perl Resource Kit online site at http://perl.oreilly.com/. At this site you can find information on troubleshooting, technical support, ideas for using Perl, more tools and samples, and links to more information. You will also find a listing of other reference books on Perl and related topics that can help you solve the problem you are facing. The list of O'Reilly books on Perl is growing every month (to say nothing of the list of Java books). Check this site regularly for updated information, news, and help.There is a wealth of online resources at your disposal, as well. The Perl Language Home page, at http://www.perl.com/, includes a comprehensive overview of all things Perl, as well as links to the various Perl FAQs (Frequently Asked Questions) other sites. If you have access to Usenet news, you will find the following newsgroups to be extremely useful sources of information:
Copyright 1998, O'Reilly & Associates, Inc.
|