<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2654.45">
<TITLE>Writing Apache Modules with Perl and C</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>Writing Apache Modules with Perl and C</FONT>
<BR><FONT SIZE=2>Authors: Lincoln Stein, Doug MacEachern</FONT>
<BR><FONT SIZE=2>Publisher: O'Reilly</FONT>
<BR><FONT SIZE=2>Published: 1999-03</FONT>
<BR><FONT SIZE=2>ISBN: 156592567X</FONT>
</P>

<P><FONT SIZE=2>&quot;Writing Apache Modules with Perl and C&quot; is an excellent introduction to the Apache 1.X API and mod_perl. The book assumes an intermediate understanding of Perl, but only a passing familiarity with the Hyper Text Transfer Protocol (HTTP) and Apache. Though if you choose to read this book you won't have only a passing familiarity for long. By the time you finish reading this book for the first time you will have a thorough understanding of how web servers work in general and Apache API in detail. Then you can go back and read it again and you'll find you're still learning ;)</FONT></P>

<P><FONT SIZE=2>Admittedly the book is written to illustrate the Apache API through mod_perl with much emphasis on &quot;Perl&quot;. However reference and commentary on the C API is provided in the appendices. Even though it was published in 1999 the book is still very relevant. &quot;mod_perl Developer's Cookbook&quot; (ISBN: 0672322404, published: 2003-01) which is also highly regarded, recommends &quot;Writing Apache Modules with Perl and C&quot; as being &quot;absolutely indispensable&quot;.</FONT></P>

<P><FONT SIZE=2>The book starts with a history of server-side technologies which have shaped and influenced how Apache came to be. It follows with an introduction to Apache walking the reader through the installation, configuration and directives necessary to get up and running with Apache and mod_perl. And of course it provides the gratuitous &quot;hello world&quot; example. During the introduction, the authors do an excellent job of balancing UNIX and Win32, C and Perl. The rest of the book however, gradually slides into an assumption of UNIX and Perl.</FONT></P>

<P><FONT SIZE=2>At this point the authors begin to cover the basics of how HTTP servers work, the Apache process' life cycle: startup, module initialization, child initialization, request loop, child exit, and shutdown, and then continue on with the phases of the request loop. Which assuming success is request, post-read-request, uri translation, header parsing, access control, authentication, authorization, mime-type checking, fixups, response, logging, and cleanup.</FONT></P>

<P><FONT SIZE=2>They then present the Handler API. In short, a handler is a hook which allows a programmer to modify what actually occurs at the particular phase being handled. They proceed to describe how you can provide handlers for each of the request phases provided by the C API and a couple available only to under mod_perl. The authors look in considerable detail at various illustrative scenarios for content generation handlers, maintaining state, and the trinity of access control, authentication, and authorization. Strictly speaking maintaining state isn't a subject tied to the Apache API. But the coverage of session state is valuable in itself and its placement and presentation flow naturally. </FONT></P>

<P><FONT SIZE=2>Throughout the text, the authors illustrate various methods of addressing issues relevant to each phase of the request loop. They highlight relative advantages and disadvantages of various techniques and give the reader advice on when and where each approach is appropriate. This type of advice is absolutely invaluable. For example: when to use cookies versus shared memory or persistent data storage in the context of browser compatibility and security. The problems and code examples may appear to be contrived and/or simplistic, but they server very well to teach you the why's and not just the how's of what you need to know.</FONT></P>

<P><FONT SIZE=2>Also covered are topics such as debugging, subclassing the Apache class, and customizing apache configuration. Throughout the book the authors mention many of the standard Apache modules and many that are not. It is in this area that the book begins to show its age. For instance, the authors mention that Apache::Request will soon be released on CPAN. This module was released back in 1999, and many current Apache modules absolutely can't work without it.</FONT></P>

<P><FONT SIZE=2>I'm not sure whether &quot;Practical mod_perl&quot; which is currently due to be released in May of 2003 is intended to supplant or augment this text. Time will tell. But if this book is the measure, the bar will be very high indeed. I do hope Stein and MacEachern will consider an update. And if they do, I hope they'll add more info on performance tuning and debugging. </FONT></P>

<P><FONT SIZE=2>--</FONT>
<BR><FONT SIZE=2>Garrett Goebel</FONT>
<BR><FONT SIZE=2>IS Development Specialist</FONT>
</P>

<P><FONT SIZE=2>ScriptPro&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Direct: 913.403.5261</FONT>
<BR><FONT SIZE=2>5828 Reeds Road&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Main:&nbsp;&nbsp; 913.384.1008</FONT>
<BR><FONT SIZE=2>Mission, KS 66202&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Fax:&nbsp;&nbsp;&nbsp; 913.384.2180</FONT>
<BR><FONT SIZE=2>www.scriptpro.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; garrett at scriptpro dot com</FONT>
</P>

</BODY>
</HTML>