The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Konstrukt::Handler::Apache - Handler for an Apache request

SYNOPSIS

Handle an apache request

        Konstrukt::Handler::Apache::handler($request);

Plugins and other module may access some request-specific data:

        #the absolute path to the processed file
        $Konstrukt::Handler->{abs_filename}
        
        #the path to the processed file relative to the document root
        $Konstrukt::Handler->{filename}
        
        #the apache request object. shouldn't be used for compatibility reasons.
        $Konstrukt::Handler->{apache_request}
        
        #the environment variables of this process as an hashref
        $Konstrukt::Handler->{ENV}
        
        #cookies as an hashref of cookie objects
        $Konstrukt::Handler->{cookies}
        #create new cookie:
        $Konstrukt::Handler->{foo} = CGI::Cookie->new(-name => 'foo', -value => 'bar');

DESCRIPTION

Parses the requested file against special (e.g. <&...&>) tags.

CONFIGURATION

Tell Apache to apply the PerlHandler on the requested files.

        #You may load a startup script that loads all the modules at startup
        #PerlRequire  perl-scripts/script_to_load_at_startup.pl
        
        #mod_perl 1
        <IfDefine !MODPERL2>
                PerlWarn On
                PerlFreshRestart On
        </IfDefine>
        
        #mod_perl 2
        <IfDefine MODPERL2>
                #Some useful options
                PerlSwitches -w #mod_perl 2
                
                #Monitor and reload all modules in %INC:
                #httpd.conf:
                PerlModule Apache2::Reload
                PerlInitHandler Apache2::Reload
                
                #Alternatively: Reload a specific set of modules only
                PerlModule Apache2::Reload
                PerlInitHandler Apache2::Reload
                PerlSetVar ReloadAll Off
                #Then any modules with the line:
                # use Apache2::Reload;
                #Will be reloaded when they change.
                #You can also sepcify the modules to be reloaded manually
                PerlSetVar ReloadModules "My::Foo My::Bar Foo::Bar::Test"
                PerlSetVar ReloadDirectories "/tmp/project1 /tmp/project2"
                #Note that ReloadModules and ReloadDirectories will narrow down the set
                #of modules to reload.
                #To monitor the reloading of modules use:
                PerlSetVar ReloadDebug On
        </IfDefine>
        
        #Preload Module
        PerlModule Konstrukt
        PerlModule Konstrukt::Handler::Apache
        
        #You may also assign the handler to *.html
        <Files *.ihtml>
                <IfDefine !MODPERL2>
                        SetHandler  perl-script
                </IfDefine>
                <IfDefine MODPERL2>
                        SetHandler  modperl
                </IfDefine>
                PerlHandler Konstrukt::Handler::Apache
        </Files>

        #Do not allow access to *.template, *.form and konstrukt.settings files
        #as they contain sensitive information
        <FilesMatch "(\.template|\.form|konstrukt\.settings)$">
                Deny from All
        </FilesMatch>

FUNCTIONS

handler

Handles the request.

Filter a file before returning it to the web client.

Parameters:

  • $request - The Apache request

AUTHOR

Copyright 2006 Thomas Wittek (mail at gedankenkonstrukt dot de). All rights reserved.

This document is free software. It is distributed under the same terms as Perl itself.

SEE ALSO

Konstrukt::Handler, Konstrukt