Chapter 14. Using mod_perl Handlers
In Chapter 13, you learned what mod_perl is and how it can be used, what different types of mod_perl handlers there are, and what stages of the Apache life cycle and the HTTP request phase cycle they can be implemented for.
You probably are curious to see just what this really means. If you are like the author, you thought more in terms of writing Perl code to implement a web application, displaying content, processing input, and displaying other content based on user input. This all happened at the HTTP request response phase. mod_perl is about much more than just implementing functionality at the response phase. It's about having complete access to the Apache life cycle and HTTP request cycle. This is what the various handlers are for. They take advantage of Apache 2.0/2.2 hooks, which provide modules with the ability to alter the way Apache runs at given phases of its life cycle. mod_perl gives you the same ability to do what Apache module developers do.
This chapter will show you some simple, practical examples that give you a hint of how powerful mod_perl handlers can be. Also, these examples will use MySQL and memcached to show you how you could theoretically build an entire system around Apache using mod_perl that has access to the same database.
PerlResponseHandler Example
The first handler you probably want to see is a PerlResponseHandler
, since this would be the most common handler you would implement for your various web application requirements. ...
Get Developing Web Applications with Perl, memcached, MySQL® and Apache now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.