mod_perl

DEVELOPER'S COOKBOOK

GEOFFREY YOUNG
PAUL LINDNER
RANDY KOBES
 Home  |  Reviews  |  Table of Contents  |  Sample Chapters  |  Source Code  |  Authors  |  Errata  |  Resources  |  Contact  Purchase Now 
  
 From the Introduction

mod_perl lies firmly at the intersection of Apache and Perl. It contains the combined strengths (and alas, weaknesses) of each system. Luckily the two go great together and make a very powerful and compelling platform for developing commercial grade Web applications.

People with just a cursory knowledge of mod_perl will tell you that mod_perl is simply faster CGI. Although this is certainly a benefit of the interface, it is hardly its most interesting or powerful facet. mod_perl offers a Perl interface to the Apache API. Before mod_perl, the only way to extend or interface with Apache was to write C extension modules, which, while offering high performance, made creating full-scale Web applications difficult. With mod_perl, developers can now harness the power of the full Apache API with Perl, a language designed for flexibility, and develop Web applications quickly, without sacrificing performance.

Day-to-day mod_perl development consists, to some degree, of figuring out how to do something that someone else has already mapped out. One of the benefits of open-source programming is that if you keep up with the latest mailing lists, newsgroups, and online periodicals, you do not have to struggle over the same four or five lines of idiomatic code that someone else is already willing to share with you. Unfortunately, gleaning all that can be obtained from these sources without spending an inordinate amount of time doing so is practically impossible.

This book is a practical, hands-on guide that shows you how to exploit the power of mod_perl. Most of our recipes explore a particular problem by providing a working, real-world solution. Some examples are quite simple. Others are rather involved,and might take some time and thought to digest in their entirety. In either case, this book tries to present the material in an accessible, logical order such that you can either use it as a reference book or as an aid to begin "thinking in mod_perl."

We hope that some of our ideas and code end up in the design and implementation of your own systems.

 How To Use This Book

Although this book covers a lot of ground, it is by no means comprehensive. In fact, we have not even attempted to write the only mod_perl book you will ever need. The mod_perl Developer's Cookbook was designed to augment existing sources of information, and perhaps provide a gateway into areas of mod_perl that are understood by advanced users, but not really documented anywhere else.

Outside of this work, the other book on your shelf needs to be Writing Apache Modules with Perl and C by Lincoln Stein and Doug MacEachern, commonly referred to as "the Eagle book" or, in really old mailing list archives, "wrapmod." This book is absolutely indispensable and should be read cover to cover at least twice by any mod_perl developer. Also of the utmost importance is the mod_perl Guide, maintained by Stas Bekman and available online at http://perl.apache.org/guide/. The Guide contains the collective knowledge of the entire mod_perl community and is updated regularly with the most current state of affairs. In addition to these two sources, the mod_perl distribution comes with a large quantity of reference documen- tation that you will want to keep at hand.

This book is aimed mostly at Perl developers who want to use the power of Apache to create Web applications and deliver services. Beginners will find solutions that help them get going quickly. Advanced users will find useful nuggets of overlooked mod_perl features. Web site system administrators will find the installation and performance monitoring recipes useful.

In our discussions, we assume that the reader has a good background in Perl, a fair understanding of Apache, and understands the basic concepts of building a Web application, Web protocols, and HTML. In some of the more complex examples we may assume a level of mastery that exceeds the typical audience. However, working through these will (hopefully) take you places within Apache, Perl, and mod_perl that you have never been, and extend your knowledge of these platforms.