Who This Book Is For

This book is not solely about mod_perl web development. It covers two main topics: server administration and programming under mod_perl.

At first, you might think these two topics are unrelated. But in real life, the programmer often needs to know how to build and maintain the server, and the administrator ends up doing much of the programming and tweaking himself.

In this book, administrators will learn:

  • How to build and configure the server, with emphasis on improving server performance while keeping memory usage low.

  • How to make sure the server is operating nonstop and, in case of malfunction, how to get it back online in no time.

  • How to maximize performance by using multiple servers and additional tools such as proxies.

  • How to choose the right machine and components. Often the most expensive machine isn't much faster than a cheaper one with more carefully chosen components.

  • How to allow users to run custom scripts on a mod_perl server.

As for programmers, the good news is that you can be a capable mod_perl programmer while knowing very little about it. But most of us don't want to stop at being simply capable: we want to develop code that's robust, scalable, and blindingly fast. Here's a taste of the sort of things we cover in this book:

  • In CGI, it's often hard to find what's wrong with a CGI script that returns a nondescriptive error message to your browser. You can try the error_log file, but with a complex script you have to use the -d switch and call the Perl debugger, which can be difficult for CGI scripts that can't be run from the shell. In Chapter 22, we'll show you how you can run the script in debug mode and control it.

  • Alas, mod_perl is picky about coding style?for example, it doesn't like it when you forget to close a file after opening it. But if you ask nicely, it might enter a special mode where it will clean up for you. In Chapter 6, we'll show you how to keep mod_perl happy and keep the error_log file small.

  • As you may already know, mod_perl is very fast. But with a little effort you can make it even faster. The idea is simple: the more memory (RAM) you have, the more requests you will be able to serve. However, you may be able to serve more requests using the same amount of RAM, thanks to memory sharing. For more information, see Chapter 10.

  • With mod_perl, you never need to reinvent the wheel. If you need a so-called "shelf solution," this book includes quite a few copy-and-paste scenarios to inspire you.

  • Many programmers use mod_perl in conjunction with databases. We start with the simplest and most basic databases (flat files), continue to Database Management (DBM) implementations, and finally do an in-depth study of relational databases with SQL.

Of course, there's lots more, as you can tell from just the sheer size and weight of the book. This book is filled with gems of information that, taken together, provide a wealth of information on how to work effectively with mod_perl.



    Part I: mod_perl Administration
    Part II: mod_perl Performance
    Part VI: Appendixes