mod_perl2 User's Guide
By Stas Bekman, Jim Brandt
By Stas Bekman, Eric Cholet
Since mod_perl's inception in 1996, many things have changed, and it's interesting to look at mod_perl's evolution and related events during the time from then to now.
Based on the mod_perl Changes file and talks with mod_perl developer's, we have here reconstructed the important steps in the development of this successful Open Source project.
The first version of mod_perl was written by Gisle Aas and released on March 25, 1996. The effort was instantly recognized by Doug MacEachern and Andreas Koenig; the former had been working on Perl embedding. They picked up the torch and brought the project we all love to what it has become today, thanks to the help of countless contributors.
An extract from Changes (the first one):
=item March 25, 1996 Initial version of mod_perl.c and perl_glue.xs by Gisle Aas <aas (at) oslonett.no> Thanks for getting this started Gisle!
Andreas Koenig tells us about how things happened:
"It was a time when FastCGI was still considered cool. But making FastCGI work required a patched perl, since tied file handles were still in their infancy.
"PHP was also around already, and was an embarrassing witness to Perl's greatest weakness for server-side programming: that embedding Perl was a pain. Although the hooks were there for embedding Perl, they were both undocumented and buggy.
"Doug MacEachern first got involved by addressing these problems. He
wrote documentation for embedding Perl (the
perlembed manpage) and
fixed a couple of bugs. Then one day, Gisle Aas posted on
perl5-porters that he had built Apache with an embedded Perl
interpreter as a proof-of-concept. However, Gisle lacked the time for
"That announcement was like a lightening bolt for at least two guys:
Doug and me. While Doug shuffled the C code, I wrote the first working
Makefile.PL, or at least I smoothed the build process to reduce the
error rate resulting from silly mistakes during installation. Doug was
working on HP-UX and I was using IRIX, so Doug wrote
ExtUtils::Embed to generate the command line arguments for gcc
that tie things together for embedded applications.
"Early versions of mod_perl needed to be recompiled to add a single
CGI application. To get over that, I invented something without a name
that mapped filenames to perl package names. When Doug received it, he
Apache::Registry, as noted in Changes:
=item release 0.75a1 - July 21, 1996 added Apache::Registry module contributed by Andreas Koenig <andreas.koenig (at) franz.ww.tu-berlin.de>
"From that moment in July 1996, we could count on a number of interested developers on the mailing list to test the nascent mod_perl. The Changes file mentions a few of them: Salvador Ortiz, Alan Beale, and John Detloff. Rob Hartill of IMDB fame joined us in July. (See contributors for more information.)
In August 1996, time was ripe to let a production server run mod_perl,
and PAUSE (the Perl Authors Upload Server) was the first such
server. We still had to use
$r->print, and couldn't
CGI", but we could add and remove scripts without recompiling and we
were happy. Being unable to use the popular
CGI.pm module turned
out to be a pain for us, so I wrote a complete
CGI::XA and hoped that Lincoln would pick up the ball once there
was a working alternative implementation. Eventually, Lincoln (with
the encouragement of Mike Stok) made
CGI.pm compatible with
mod_perl starting with
CGI.pm 2.32, and in March 1997,
was removed from the mod_perl distribution. This was one of the most
important entries into the Changes file:
=item 0.95 - 03/20/97 ****************************************** *** CGI-XA/* removed from distribution *** CGI.pm-2.32 is now mod_perl compatible, and now ships with CGI::Switch and CGI::Apache. ******************************************
Can you feel the relief it was for Doug to write that? I think this was the greatest day of the whole development. One year of very tough work got the reward it deserved.
After that, mod_perl started to get attention from an increasing number of users. Doug worked like mad on fixing bugs and inventing one thing after another, just as he still does today. Things started flowing and people sent in patches, so Doug got the impression that the bazaar model was beginning to work. (From Eric Raymond's essay "The Cathedral and the Bazaar," the unofficial manifesto of the Open Source movement.)
I remember one day Doug got a confidential message from a Sun employee. They had made an investigation on "where the web is heading", and they had come to the conclusion that "mod_perl will have an impact on the whole Web"."
The first public release after Gisle's proof-of-concept happened on May 1, 1996: release 0.50a1 of mod_perl, with a long list of changes.
In 0.50a2, an alternative implementation was provided, mod_perl_fast, which became the standard in 0.83_10.
Another probably important change was the possibility of using
$r->print, greatly facilitating output
=item release 0.80 - September 06, 1996 [...] we now take advantage of Perl's new IO abstraction so STDIN and STDOUT are hooked up to the client. Thanks to Sven Verdoolaege <email@example.com> for the initial patch
With 0.85 came the start of the test suite!
=item 0.85 added the start of a mod_perl test suite
Another interesting feature was added just before 1.0: stacked handlers!
=item 0.95_02 introduced experimental "stacked handlers" mechanism, allowing more than one Perl*Handler to be defined and run during each stage of the request. Perl*Handler directives can now define any number of subroutines, e.g. PerlTransHandler OneTrans TwoTrans RedTrans BlueTrans with a new method, Apache->push_handlers can add to the stack by scripts at runtime
And just after that, our beloved
=item 0.95_03 [...] added <Perl> config section (see httpd.conf.pl) (needs 'perl Makefile.PL PERL_SECTIONS=1')
Finally, more than one year after Doug's original 0.50a1, 1.0 was released on July 28 1997:
=item 1.00 - 07/28/97
It primarily began adapting to the 1.3 series of Apache.
During 1.x development, there has generally been many bug fixes and adaptions to Apache and Perl versions, striving to remain compatible. Some parts stand out as pretty important.
In v1.12, the important APACI-support was added thanks to Ralf S. Engelschall:
=item 1.12 - June 14, 1998 added new (but still optional!) Apache 1.3 support via the new Apache Autoconf-style Interface (APACI): The option USE_APACI=1 triggers a new build-environment (from local apaci/) for the APACHE_SRC/src/modules/perl/ which provides a clean way (i.e. without patching anything inside APACHE_SRC, not even the Configuration file) of configuring mod_perl via a APACHE_SRC/src/modules/perl/mod_perl.config file. The complete configuration is enabled by just using the APACI command "configure --activate-module=src/modules/perl/libperl.a" [Ralf S. Engelschall <firstname.lastname@example.org>]
And with new versions of Perl come new fixes to mod_perl of course.
=item 1.22 - March 22, 2000 compile fixes for 5.6 + -Duse5005threads [Lincoln Stein <email@example.com>]
But the most important happenings weren't the bug fixes in the mod_perl core, but all that happened around it. The usage statistics show an incredible boom in mod_perl deployment, which has been accompanied by the release of very interesting applications and frameworks for mod_perl.
Maybe even more interesting are the things happening around mod_perl, mainly concerning Perl and Apache. The reason is that this impacts as much on mod_perl users as the changes to mod_perl itself; for example, a bug fix in Perl will help a lot to someone writing Perl handlers, and a security fix in Apache is of immense benefit to anyone running an Apache server.
Writing Apache Modules with Perl and C (http://www.modperl.com/), by Lincoln Stein and Doug MacEachern, for a long time considered the best resource for mod_perl programmers, was published in March 1999 by O'Reilly & Associates. While not the only book on the subject, it is still a must-have for any serious mod_perl programmer.
At ApacheCon in Orlando in 1999, mod_perl officially became an Apache Software Foundation project, and Ask Bjørn Hansen, Eric Cholet and Stas Bekman were voted in as ASF members in addition to Doug MacEachern. Together they formed the mod_perl PMC.
In March 2000, Perl 5.6.0 was released, bringing many new features to Perl and mod_perl programmers the world over.
In October 2000, Take23 (http://www.take23.org/) was created as an alternative site for mod_perl, because of the back-and-forth discussions about re-designing the perl.apache.org site weren't going anywhere at that time. It collected news and articles about mod_perl and also related issues such as other interesting Apache modules. It wasn't maintained for several years, and somewhere in 2003 it has disappeared.
Also in October 2000, Geoffrey Young got the idea to begin a mod_perl mailing list digest (see http://marc.theaimsgroup.com/?l=apache-modperl-dev&m=97051473628623&w=2 and http://marc.theaimsgroup.com/?l=apache-modperl&m=97059662005378&w=2 ), which he kept up regularly (weekly, then biweekly) up until late 2001, when James G. Smith took over and has been running it since then.
The mod_perl Pocket Reference (http://www.oreilly.com/catalog/modperlpr/), by Andrew Ford, was published by O'Reilly and Associates in December 2000. It summarizes the whole mod_perl API as well as configuration directives and some other tips in an easy-to-use format.
In January 2002, the mod_perl Developer's Cookbook (http://www.modperlcookbook.org/), authored by Geoffrey Young, Paul Lindner and Randy Kobes, was published by Sams Publishing. It presents the mod_perl API by example, teaching a programmer all the facets of mod_perl installation, programming and configuration, and is a valuable resource to everyone.
META: - mailing list creations - beginnings of new site - conferences w/ mod_perl present - when Doug and Stas funded? Stas: August 2001; end 2002
mod_perl has clearly shown its strength as an Open Source project and application development platform. mod_perl 2.0 has been a jump forward, but with the arrival of Perl 6 we might expect another new version of mod_perl. If the developers are still interested, that is. There has been started development on mod_parrot (http://svn.perl.org/parrot-modules/mod_parrot), but Perl 6 is far from ready, so we don't really know what will be needed. The future hold great things for us.
I will quote Stas Bekman's commentary in the contributors list:
"He is now thinking about mod_perl 3.0's architecture, hopefully to be implemented solely with AND and OR gates, driven by the Perl 6.0 chipset for the best performance. Don't be surprised when you get offered a shiny Bluetooth mod_perl 3.0 PCI card when you shop for your new server machine."
CPAST: Comprehensive Perl Arcana Society Tapestry, http://history.perl.org/
About the Apache HTTP Server Project, http://httpd.apache.org/ABOUT_APACHE.html
The perlhist manpage, containing records of all perl versions, and the perl*delta manpages relating changes in the respective versions.
The maintainer is the person you should contact with updates, corrections and patches.
Per Einar Ellefsen <pereinar (at) oslo.online.no>
Per Einar Ellefsen <pereinar (at) oslo.online.no>
Only the major authors are listed above. For contributors see the Changes file.