Apache::XAO - Apache XAO handler


In httpd.conf or <VirtualHost ..> section:

 PerlFreshRestart   On
 PerlSetVar         SiteName        testsite
 SetHandler         perl-script
 PerlTransHandler   Apache::XAO


Apache::XAO provides a clean way to integrate XAO::Web based web sites into mod_perl for maximum performance. The same site can still be used in CGI mode (see XAO::Web::Intro for configuration samples).

Apache::XAO must be installed as PerlTransHandler, not as a PerlHandler.

If some areas of the tree need to be excluded from XAO::Web (as it usually happens with images -- /images or something similar) these areas need to be configured in the site's configuration. This is described in details below.

As a convenience, there is also a simple way to exclude certain locations using Apache configuration only. Most common is ExtFilesMap:

 PerlSetVar         ExtFilesMap     /images

This tells Apache::XAO to map everything under /images location in URI to physical files in 'images' directory off the project home directory. For a site named 'testsite' this is roughly the same as the following, only you do not have to worry about exact path to site's home directory:

 Alias              /images         /usr/local/xao/projects/testsite/images

To achieve the same effect from the site configuration you need:

 path_mapping_table => {
     '/images' => {
         type        => 'maptodir',

A more generic way is to just disable Apache::XAO from handling some area altogether:

 PerlSetVar         ExtFiles        /images

In this case no mapping is performed and generally Apache::XAO does nothing and lets Apache handle the files.

A site configuration equivalent is:

 path_mapping_table => {
     '/images' => {
         type        => 'external',

More then one prefix can be listed using ':' as a separator:

 PerlSetVar         ExtFilesMap     /images:/icons:/ftp


Using Apache::XAO gives of course incomparable with CGI mode performance, but even in comparision with mod_rewrite/mod_perl combination we got 5 to 10 percent boost in performance in tests.

Not to mention cleaner looking config files and reduced server memory footprint -- no need to load mod_rewrite.

For additional improvement in memory size it is recommended to add the following line into the main Apache httpd.conf (not into any VirtualHost):

 PerlModule XAO::PreLoad

This way most of XAO modules will be pre-compiled and shared between all apache child processes thus saving memory and child startup time.




Copyright (c) 2005 Andrew Maltsev

Copyright (c) 2001-2004 Andrew Maltsev, XAO Inc.

<> --


Recommended reading: XAO::Web::Intro, XAO::Web, XAO::DO::Config, Apache.