• RRP: £39.99
  • You Save: £24.47 (61%)
FREE Delivery in the UK.
Only 2 left in stock (more on the way).
Dispatched from and sold by Amazon. Gift-wrap available.
Practical mod_perl has been added to your Basket
+ £2.80 UK delivery
Used: Good | Details
Condition: Used: Good
Comment: Expedited shipping available on this book. The book has been read but remains in clean condition. All pages are intact and the cover is intact. Some minor wear to the spine.
Have one to sell?
Flip to back Flip to front
Listen Playing... Paused   You're listening to a sample of the Audible audio edition.
Learn more
See this image

Practical mod_perl Paperback – 2 Jun 2003

5.0 out of 5 stars 2 customer reviews

See all 3 formats and editions Hide other formats and editions
Amazon Price
New from Used from
Kindle Edition
"Please retry"
Paperback
"Please retry"
£15.52
£15.52 £2.67
Note: This item is eligible for click and collect. Details
Pick up your parcel at a time and place that suits you.
  • Choose from over 13,000 locations across the UK
  • Prime members get unlimited deliveries at no additional cost
How to order to an Amazon Pickup Location?
  1. Find your preferred location and add it to your address book
  2. Dispatch to this address when you check out
Learn more

Great Discounts
Shop the Books Outlet. Discover some great deals on top titles. Shop now
£15.52 FREE Delivery in the UK. Only 2 left in stock (more on the way). Dispatched from and sold by Amazon. Gift-wrap available.
click to open popover

Enter your mobile number or email address below and we'll send you a link to download the free Kindle App. Then you can start reading Kindle books on your smartphone, tablet, or computer - no Kindle device required.

  • Apple
  • Android
  • Windows Phone

To get the free app, enter your mobile phone number.



Product details

  • Paperback: 928 pages
  • Publisher: O'Reilly Media; 1 edition (2 Jun. 2003)
  • Language: English
  • ISBN-10: 0596002270
  • ISBN-13: 978-0596002275
  • Product Dimensions: 17.8 x 4.9 x 23.3 cm
  • Average Customer Review: 5.0 out of 5 stars  See all reviews (2 customer reviews)
  • Amazon Bestsellers Rank: 1,703,525 in Books (See Top 100 in Books)
  • If you are a seller for this product, would you like to suggest updates through seller support?

  • See Complete Table of Contents

Product description

About the Author

Stas Bekman is the author of The mod_perl Guide, the Open Source document that is the basis for this book. Stas is a member of the Apache Software Foundation and is a multiple speaker at the O'Reilly Open Source Conference. Stas is also a regular author for Perl.com.

Eric Cholet is a member of the Apache Software Foundation and the Paris Perl Mongers. He is technical director of Logilune, a Paris-based company that he co-founded in 1987, and a speaker at the O'Reilly Open Source Conference.

Excerpt. © Reprinted by permission. All rights reserved.

CHAPTER 6 - Coding with mod_perl in Mind

This is the most important chapter of this book. In this chapter, we cover all the nuances the programmer should know when porting an existing CGI script to work under mod_perl, or when writing one from scratch.

This chapter’s main goal is to teach the reader how to think in mod_perl. It involves showing most of the mod_perl peculiarities and possible traps the programmer might fall into. It also shows you some of the things that are impossible with vanilla CGI but easily done with mod_perl.

Before You Start to Code
There are three important things you need to know before you start your journey in a mod_perl world: how to access mod_perl and related documentation, and how to develop your Perl code when the strict and warnings modes are enabled.

Accessing Documentation
mod_perl doesn’t tolerate sloppy programming. Although we’re confident that you’re a talented, meticulously careful programmer whose programs run perfectly every time, you still might want to tighten up some of your Perl programming practices.

In this chapter, we include discussions that rely on prior knowledge of some areas of Perl, and we provide short refreshers where necessary. We assume that you can already program in Perl and that you are comfortable with finding Perl-related information in books and Perl documentation. There are many Perl books that you may find helpful. We list some of these in the reference sections at the end of each chapter.

If you prefer the documentation that comes with Perl, you can use either its online version or the perldoc utility, which provides access to the documentation installed on your system. To find out what Perl manpages are available, execute:

panic% perldoc perl

For example, to find what functions Perl has and to learn about their usage, execute:

panic% perldoc perlfunc

To learn the syntax and to find examples of a specific function, use the -f flag and the name of the function. For example, to learn more about open( ), execute:

panic% perldoc -f open

The perldoc supplied with Perl versions prior to 5.6.0 presents the information in POD (Plain Old Documentation) format. From 5.6.0 onwards, the documentation is shown in manpage format.

You may find the perlfaq manpages very useful, too. To find all the FAQs (Frequently Asked Questions) about a function, use the -q flag. For example, to search through the FAQs for the open( ) function, execute:

panic% perldoc -q open

This will show you all the relevant question and answer sections.

Finally, to learn about perldoc itself, refer to the perldoc manpage:

panic% perldoc perldoc

The documentation available through perldoc provides good information and examples, and should be able to answer most Perl questions that arise.

Chapter 23 provides more information about mod_perl and related documentation.

The strict Pragma
We’re sure you already do this, but it’s absolutely essential to start all your scripts and modules with:

use strict;

It’s especially important to have the strict pragma enabled under mod_perl. While it’s not required by the language, its use cannot be too strongly recommended. It will save you a great deal of time. And, of course, clean scripts will still run under mod_cgi! In the rare cases where it is necessary, you can turn off the strict pragma, or a part of it, inside a block. For example, if you want to use symbolic references (see the perlref manpage) inside a particular block, you can use no strict 'refs';, as follows:

use strict;
{
no strict 'refs';
my $var_ref = 'foo';
$$var_ref = 1;
}

Starting the block with no strict 'refs'; allows you to use symbolic references in the rest of the block. Outside this block, the use of symbolic references will trigger a runtime error.

Enabling Warnings
It’s also important to develop your code with Perl reporting every possible relevant warning. Under mod_perl, you can turn this mode on globally, just like you would by using the -w command-line switch to Perl. Add this directive to httpd.conf:

PerlWarn On

In Perl 5.6.0 and later, you can also enable warnings only for the scope of a file, by adding:

use warnings;

at the top of your code. You can turn them off in the same way as strict for certain blocks. See the warnings manpage for more information.

We will talk extensively about warnings in many sections of the book. Perl code written for mod_perl should run without generating any warnings with both the strict and warnings pragmas in effect (that is, with use strict and PerlWarn On or use warnings).

Warnings are almost always caused by errors in your code, but on some occasions you may get warnings for totally legitimate code. That’s part of why they’re warnings and not errors. In the unlikely event that your code really does reveal a spurious warning, it is possible to switch off the warning.

Exposing Apache::Registry Secrets
Let’s start with some simple code and see what can go wrong with it. This simple CGI script initializes a variable $counter to 0 and prints its value to the browser while incrementing it:

#!/usr/bin/perl -w
use strict;
print "Content-type: text/plain\n\n";
my $counter = 0;
for (1..5) {
increment_counter( );
}
sub increment_counter {
$counter++;
print "Counter is equal to $counter !\n";
}
When issuing a request to /perl/counter.pl or a similar script, we would expect to see
the following output:

Counter is equal to 1 !
Counter is equal to 2 !
Counter is equal to 3 !
Counter is equal to 4 !
Counter is equal to 5 !

And in fact that’s what we see when we execute this script for the first time. But let’s
reload it a few times.... After a few reloads, the counter suddenly stops counting from
1. As we continue to reload, we see that it keeps on growing, but not steadily, starting almost randomly at 10, 10, 10, 15, 20..., which makes no sense at all!

Customer Reviews

5.0 out of 5 stars
5 star
2
4 star
0
3 star
0
2 star
0
1 star
0
See both customer reviews
Share your thoughts with other customers

Top Customer Reviews

Format: Paperback
At almost 900 pages, this is certainly the biggest book on mod_perl that has been published so far. In my opinion it's also one of the most useful.
Stas Bekman and Eric Cholet are two of the best-known and (probably more importantly) most respected names in the mod_perl community so you can be sure the the information you get in this book is going to be top quality.
Part 1 of the book is about mod_perl administration. It starts with an overview of what mod_perl is and how it relates to CGI and the Apache web server before going into a chapter which gives a quickstart guide to installing and using mod_perl on some of the most common platforms. Chapter three then goes back over the installation process in far more detail. Chapter four explains how to configure mod_perl in various ways and chapter five cover monitoring, upgrading and maintaining your mod_perl enabled web server. Chapter 6 is full of advice about how to write Perl code that takes advantage of mod_perl's features.
Part 2 is all about mod_perl performance and contains chapters about benchmarking and tuning your server. I found chapter twelve to be particularly useful as it discusses a number of useful strategies for splitting server load between a mod_perl server for dynmaic content and a "plain" (non-mod_perl) server for static content. Other chapters in this section cover other strategies for improving performance by tuning Apache's configuration, changing your Apache and mod_perl build options and being cleverer about the HTTP headers that you return.
Most dynamic web sites have a database involved somewhere so part 3 covers using databases with mod_perl. Part 4 is all about debugging and troubleshooting your mod_perl server.
Read more ›
Comment 3 people found this helpful. Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback.
Sorry, we failed to record your vote. Please try again
Report abuse
Format: Paperback
I bought this book to better understand mod_perl. I didn't expect such a thick tome to be the result - 924 pages. However, I've read every page.
The book covers many areas of mod_perl with thoroughness I didn't expect. What also surprised me was the amount of experience & advice about general web-serving issues & setup options. I've certainly learned more about this area, and its helped clarify some of my thinking especially about performance & security.
Some areas I was surprised were included, such as using DBM's, which (though interesting) seemed of minimal relevance to a mod_perl book. Same goes for discussions about Inline & XS. Also, you get the impression that the book was written as a number of separate essays, which results in some overlap and repitition - not necessarily a bad thing.
It was also nice to see a good overview of Apache 2 and mod_perl 2.
One thing I was looking forward to was a discussion on sharing memory & dynamic variables between Apache child processes, but unfortunately this was one of the few areas glossed over in the book.
In short, this book could easily have been presented as 2 or 3 smaller ones, so a bargain to any mod_perl user out there, or indeed any apache web-server administrator who wants some experienced advice on configuration for users.
Comment 2 people found this helpful. Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback.
Sorry, we failed to record your vote. Please try again
Report abuse

Most Helpful Customer Reviews on Amazon.com (beta)

Amazon.com: 4.6 out of 5 stars 7 reviews
5.0 out of 5 stars Truly Exceptional 3 Aug. 2013
By John Dunlap - Published on Amazon.com
Format: Kindle Edition Verified Purchase
I bought this book because I knew very little about mod_perl and because I needed to know how to configure it to run multiple versions of the same perl application within a single apache instance. This book showed me how to do that in ONE line of configuration. I would strongly recommend this book to anyone who needs to understand mod_perl. It is worth every penny.
14 of 14 people found the following review helpful
4.0 out of 5 stars Useful, informative volume on mod_perl 19 Feb. 2004
By A Williams - Published on Amazon.com
Format: Paperback
Practical mod_perl is a doorstop sized volume that provides more information on using mod_perl than you ever thought you needed.
The almost 900 pages are divided into five parts and a bunch of appendices. Part I, "mod_perl Administration" covers building, configuring and installing mod_perl, followed by some Apache details and an 80-page guide to coding with mod_perl in mind. Part II, `mod_perl Performance' deals with ways of getting the best out of Apache and mod_perl, with a little about security. Part III deals with databases, including persistent connections and data sharing. Part IV is a great guide to debugging and troubleshooting. Part V is a brief look at Apache 2 and mod_perl 2.
The appendices are useful. The first is a short section of around a dozen small `recipes' for performing various tasks using mod_perl. I found these a good base for more complex tasks, particularly when combined with examples from elsewhere in the book. The second is a list of Perl modules that extend Apache and mod_perl with a brief description of each. The third gives some strategies for providers wanting to host Apache with mod_perl. The fourth and fifth give good overviews of the Template Toolkit and AxKit, an XML application server built on mod_perl.
The book is readable, tending towards heavy writing and certainly dense, but I didn't feel this was a problem in a book meant for a fairly advanced audience. I think you'd want to be a fairly good Perl programmer and well versed in Apache before needing this volume and shouldn't expect to be spoon fed. I thought it well written.
In a book of this size you expect to find a lot of example code, and you won't be disappointed. The book is peppered with short Perl examples and example command lines and configurations, all well explained. The one shortcoming is that there aren't many examples of full-blown applications where you can see everything discussed and have it explained all in one place. I would have appreciated some more of this, the examples tend to be on the short side.
This book sits well in the marketplace. It provides more details on running, installing and configuring mod_perl and Apache than mod_perl Developer's Cookbook (and also delves more into the reasons for doing something one particular way and much more help on debugging), though the Developer's Cookbookbecomes a good companion to this volume as it provides a lot more in the way of examples. For those that want to get deep into the high end of mod_perl there is Writing Apache Modules in Perl and C, which is at core a good book on high end mod_perl programming.
O'Reilly have their usual website with Table of Contents, an example chapter, and errata. The authors have their own website with some of the same information and all the code examples from the book as both individual files and one 40k tarball.
I would recommend this book to anyone who administers and writes for mod_perl, it fills the missing pieces in mod_perl Developers Cookbook and is a good companion volume to it.
10 of 10 people found the following review helpful
5.0 out of 5 stars Definitive guide to mod_perl administration 16 Mar. 2004
By David Cross - Published on Amazon.com
Format: Paperback
At almost 900 pages, this is certainly the biggest book on mod_perl that has been published so far. In my opinion it's also one of the most useful.
Stas Bekman and Eric Cholet are two of the best-known and (probably more importantly) most respected names in the mod_perl community so you can be sure the the information you get in this book is going to be top quality.
Part 1 of the book is about mod_perl administration. It starts with an overview of what mod_perl is and how it relates to CGI and the Apache web server before going into a chapter which gives a quickstart guide to installing and using mod_perl on some of the most common platforms. Chapter three then goes back over the installation process in far more detail. Chapter four explains how to configure mod_perl in various ways and chapter five cover monitoring, upgrading and maintaining your mod_perl enabled web server. Chapter 6 is full of advice about how to write Perl code that takes advantage of mod_perl's features.
Part 2 is all about mod_perl performance and contains chapters about benchmarking and tuning your server. I found chapter twelve to be particularly useful as it discusses a number of useful strategies for splitting server load between a mod_perl server for dynmaic content and a "plain" (non-mod_perl) server for static content. Other chapters in this section cover other strategies for improving performance by tuning Apache's configuration, changing your Apache and mod_perl build options and being cleverer about the HTTP headers that you return.
Most dynamic web sites have a database involved somewhere so part 3 covers using databases with mod_perl. Part 4 is all about debugging and troubleshooting your mod_perl server. Finally, part 5 looks at what has changed with the release of the forthcoming mod_perl 2.0.
And this isn't just theoretical stuff. The two authors have been involved in developing mod_perl for a long time but they are also mod_perl users. You can just tell from the way they write that the problems they discuss are problems they have dealt with. This is the voice (or, rather, voices) of experience.
A lot of the text in the book is based on the mode_perl guide which has been available on the web for some time, but all of the content has been revisited, updated and expanded. This book is not really in competition with books like The mod_perl Developers Cookbook or the older Writing Apache Modules with Perl and C as those books largely concentrate on how to write code for mod_perl whereas the emphasis in this book is on configuring and administering a mod_perl server.
And if you are the administrator of a mod_perl server then you should really consider adding this book to your library.
6 of 6 people found the following review helpful
4.0 out of 5 stars mod_perl from the horse's mouth 11 Nov. 2004
By Egor Shipovalov - Published on Amazon.com
Format: Paperback
This one of the most informative O'Relly books by absolute metrics: almost 1000 pages packed with useful information. It pretty much covers all bases: from porting existing CGI scripts to mod_perl, to architecturing busy websites for optimal performance. One of the authors, Stas Bekman, works on mod_perl full-time, so this is it's basically as authoriative as it gets.

The only drawback of this book that I noticed is that it sometimes gets too heavy on basic Perl or sysadmin stuff, making the experienced developer flip pages in anxiety. Also, some parts are too similar to online mod_perl documentation (which is not surprising as it's written by the same person).

Still, this is the first book with substantial mod_perl2 coverage, and probably worths buying for this reason alone. All in all, if you're coding mod_perl for living, I think you owe it to yourself to have this book in your O'Relly collection.
3 of 3 people found the following review helpful
5.0 out of 5 stars An excellent investment 9 Aug. 2006
By Yogesh Makwana - Published on Amazon.com
Format: Paperback
We have been using perl for our server side programming for over 6 years now. During this period, the popularity of our web based applications has grown. To deal with the growth, we have had to optimize the programs, as well as look at alternate server setup strategies. We acquired this book as it covers both the topics of our interest -- mod_perl for efficiency of perl programs and setting up servers that use mod_perl.

In the course of the optimizations, we have gradually moved into the mod_perl world. It has yielded significant performance improvement, probably making our web application more than 50 times as fast. "Practical mod_perl" served as a guide while we carried out this transition, which has resulted in dramatic savings in our server costs. I have no hesitation in saying that this wonderful book is perhaps the best investment we have ever made in technology.
Were these reviews helpful? Let us know