Freelance Writing Jobs | Today's Articles | Sign In

 
Browse Sections

An Introduction to mod_perl


Who is this for
This article is for those who want to have an idea of what mod_perl is.

Introduction
If you have written CGI scripts to generate Dynamic HTML, you would have been satisfied with its performance. There is a way to improve the performance and your CGI scripts and that is through mod_perl.

mod_perl
mod_perl is an 'extension' to the Apache web server. It allows you to communicate with your Apache server using Perl.

For one, when the Apache web server is loaded, the Perl interpreter is loaded with it at the same time.

So you may ask, what's that got to do with performance?

Plenty!

How CGI Works
When you execute a CGI script, the Perl interpreter has to be loaded. This has to be done for all CGI scripts to be executed. This means additional overhead for each CGI script you use.

With mod_perl, the Perl interpreter is pre-loaded. This means that the overhead is done only once. Making your scripts run faster. Aside from the Perl interpreter, you can also pre-load your modules.

Communicating with the Apache Web Server
Because mod_perl is 'hooked' up to the Apache server, you can practically control the way the server by using Perl scripts.

You also have control over all stages of a request being processed by the server.

You can also include Perl code in your Apache configuration file.

Setting up mod_perl

One of my rules in installing any software is: If there is a binary distribution, use it. Do not attempt to build it from scratch. If you are using a Linux system, your distribution CD probably has mod_perl in it.

For Windows, IndigoPerl also comes with the Apache Server built with mod_perl.

If you are really bent on building mod_perl, make sure you have the source code of Perl and your Apache server handy. It is going to ask for it.

As of this writing, there are two versions of the Apache web server that you can choose: versions 1.3 and 2.0. Installing mod_perl in both versions are very different. You need to use mod_perl 1.0 for Apache server 1.3 and mod_perl 2.0 for Apache server 2.0.

Do not mix the two versions. It just won't work!

The mod_perl documentation has detailed instructions on installing mod_perl for both versions of the Apache web server.

Click on the links below to view their corresponding documentation:

Go To Page: 1 2

Articles in this Topic    Discussions in this Topic