mod_perl2 User’s Guide (modperl2book.org) by Stas Bekman and Jim Brandt has
just been published by Onyx Neon, and Amazon says it’s shipping.
I can’t think of the last time I’ve been as excited to see a Perl
book get published. Besides brian d foy‘s
Mastering Perl, there hasn’t been a significant Perl book
in quite a while. Perlbuzz is going to work with Onyx Neon to have a book
giveaway, so watch this space in the next few days.
Jim Brandt took some time to talk with me about the book, why you
need to switch to mod_perl 2, and why it took so long to get
the book to market.
Andy: Your new book mod_perl 2 User’s
Guide is now shipping. It’s an update to Practical mod_perl, probably
the thickest Perl book ever. (So thick that Liz Cortell once made
a lunchbox out of one!) How does this one compare?
Jim: In many ways it’s not an update to the first book
in the 1st edition, 2nd edition sense. Like Apache 1 and 2
and mod_perl 1 and 2, the new book is coverage of the new stuff
in mod_perl 2. Much of the content of Practical mod_perl
is still relevant. But Apache 2 brought many changes, so
mod_perl 2 had to change too. That’s what the book’s about.
And it’s not as thick.
Andy: Did you pull stuff out?
Jim: We started fresh, so we weren’t working with
Practical mod_perl as a starting point.
Andy: And so you didn’t have to go Creative Commons
Jim: Right. It’s a completely new book, so were could do
what we wanted. This version is “owned” by the Apache Software
Foundation. The full content will also be released on-line, as with
Practical mod_perl. Also, it’s an edited and updated version
of the content from
the mod_perl site, so in a
sense it’s out there now.
Andy: So how did you get involved? How much is you, how
much is Stas?
Jim: Stas created all of the original content as documentation
in the mod_perl 2 section of perl.apache.org. Allison (Randal,
publisher) began working on pulling it together into book form and
was looking for an editor. brian d foy mentioned it to me,
I got involved, then became more of an author as I got to work on
editing and re-writing sections. Stas was available throughout to
answer questions. So I guess if you run a big diff between the book
and the mod_perl 2 docs on perl.apache.org, you’ll see how
much was me. 🙂
Andy: How long did it take?
Jim: Well, a bit too long, and that was my fault. I had
a few life events that got in the way a bit. I got started nearly
2 years ago. We wanted it done by YAPC this year, but that slipped
to OSCON and we missed it. But Allison and Tom McTighe (the real editor)
really stepped up at the end and we finally pulled it together in
Andy: What surprised you most about the project?
Jim: I suppose learning how much is behind mod_perl and
how much work a core group of people do to make it happen. In that
way, it’s similar to Perl itself in that the more you know the more
you appreciate the efforts of a small group of very dedicated and
very smart people.
Andy: Please tell me there’s good stuff in the book about
migrating mod_perl 1 to mod_perl 2. It’s something I’ve
muddled through before, and I need to do it again, and I’m not
looking forward to the trip.
Jim: There are several chapters dedicated to just that.
And good information on the tools available, including a walkthrough
of migrating an actual module from 1 to 2. There are several
utilities available to help you look up methods that have moved,
which will be the first thing people hit. And the
module gets you running quickly while you make the changes you need
Andy: What in your Day Job brought you to the mod_perl 2
Jim: We use mod_perl, but we’ve been stuck at 1 because
we were using an auth module that only worked with Apache 1.
So I guess you could say nothing directly from my job was related
to mod_perl 2. It just seemed like the book needed to be out
Andy: I figured there was some tale of mod_perl 2
hell that led you down this path.
Jim: No, I did what no one does. I read the instructions
(and wrote them) first.
Andy: What should people know about mod_perl 2?
Jim: I think the main message I’d like to get out there
is that Apache 2 and mod_perl 2 have been out for a while,
they are stable, and they are the future. That’s where much of the
new development effort is going. It’s time to upgrade. With no
vendor out there to “desupport” you, people tend to hold off, but
I think it’s really time. I know I’ll be getting our Apache 2
/ mod_perl 2 migration plan going at work and we’ll be looking
to move over the next year or so.
Andy: You say that mod_perl 2 is the future, but
what if I’ve got a perfectly good, working stable app running under
Apache 1 and mod_perl 1. Staying on mod_perl 1 is certainly
building up technical debt, but what does mod_perl 2 give me
for my troubles?
Jim: It depends on how you’re using it. If you’re just
using it for CGI acceleration, you could stay where you are. The
risk you run is that some Apache 1 module you rely on might not get
that next security update. I don’t know that anyone is saying they
are going to stop support in their Apache 1 tree just yet, but it
If you use mod_perl for true module development, there are some
new features that you’ll want. The biggest is probably the access
to Apache configuration info and new ways to pass in configuration
info from Apache to your handlers. You can add custom Apache
configuration directives in pure Perl, where with mod_perl 1
you needed XS. So if you want the module user to pass some info,
you can have them load the module and it can create an Apache
directive like “PerlGods” that takes “Andy” and “Jim” as two
parameters. There’s a full Perl interface for defining how these
directives should be parsed and evaluated by Apache.
Other new features: It is now usable on Win32 because you can
run it threaded. You have more access to input and output filters
than before. And, with Apache 2 and mod_perl 2 you’re
also not limited to just the HTTP protocol any more. They’ve both
been redesigned to serve any protocol, so you could write an FTP
or SMTP server in mod_perl 2.
Andy: Would you want to?
Jim: Ah, good question. I think this area hasn’t really
been tapped much yet, so those are the sorts of examples that we
used to explain the idea. My guess is this flexibility will be used
to serve things we haven’t thought of yet.
Andy: You alluded to life changes earlier. Care to
elaborate for the reading public?
Jim: Well, my wife and I had triplets, and adding that
many babies to our already busy household put a major demand on my
time. Triplets are an amazing amount of work anyway, and trying
to squeeze in time for the book in addition to the day job was
really tough, and that’s why things stalled for a while.
Andy: Which is more likely: Working on another book,
or having more triplets?
Jim: I can see working on another book if one comes
along that I can contribute to. No more triplets, I can say that
Andy: Thanks for talking with Perl Buzz. Good luck with the book.
I hope it takes off!
Jim: Thanks! Hope you enjoy it.