For more information... RTFM!
NAVIGATION
PAGES THAT LINK HERE
ACCOUNT LOGIN

You are not logged in

Powered by Interchange version 5.7.0

Preload

Sets a macro that will be automatically executed at earliest possible stage of every page request - even before the Autoload macro (if defined) is executed.

Synopsis

Preload  subroutine_name

or

Preload  <<EOA
    Interchange tags here
EOA

The macro can be specified using the name of a Sub or GlobalSub subroutine, or it can be a block of Interchange tags.  Perl subroutines are much more efficient, of course.

Scope

This directive is only available for use in the local (catalog.cfg) configuration file.  It will not affect any other website in any way.  This directive will not work in the global (interchange.cfg) configuration file. 

Availability

Availability

This configuration directive was introduced in version 5.5.2, and is therefore not available for use with any earlier Interchange version.

Description

Sets a macro that will be automatically executed at the earliest possible stage in the request handling process.  This macro will allow you to tweak various aspects of the request and its environment, such as the request path and the user's session session, robot status, cookie status and authorisation etc.

Any value returned by the macro will be discarded.

Warning

Warning

Do not use this facility unless you know what you're doing and fully understand the implications of any environmental adjustments you make.

Also see the similar Autoload directive.

Examples

Skip the read and write of user sessions for certain page requests

You might find it useful to save the overhead of session access for pages that don't make use of the session data.  The following example will configure Interchange to skip session reads and writes for the "/aboutus", "/contact" and "/info" pages.

Put the following in your Interchange instance's global "interchange.cfg" configuration file:

GlobalSub <<EOG
sub skip_session {
    if $CGI::path_info =~ m{^/(?:aboutus|contact|info)(?:\.|$)} {
        $CGI::values{mv_tmp_session} = 1;
    }
    undef;
}
EOG

and then put the following in your website's local "catalog.cfg" configuration file:

Preload  skip_session

See also

Category:  Local config directives
Last modified by: Kevin Walsh
Modification date: Sunday 27 April 2008 at 4:18 PM (EDT)
Home  |  Legal nonsense  |  Privacy policy  |  Contact us