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

NAME

Apache::HeavyCGI::ExePlan - Creates an execution plan for Apache::HeavyCGI

SYNOPSIS

 use Apache::HeavyCGI::ExePlan;
 my $plan = Apache::HeavyCGI::ExePlan->new(
    METHODS => ["header", "parameter"],
    CLASSES => ["my_application::foo", "my_application::bar", ... ],
    DEBUG    => 1,
    WALKTYPE => "m",
    WATCHVARIABLE => "SOME VARIABLE",

 $plan->walk;

DESCRIPTION

When an execution plan object is instantiated, it immediately visits all specified classes, collects the singleton objects for these classes, and checks if the classes define the specified methods. It creates an array of objects and methods or an array of code references.

The walk method walks through the execution plan in the stored order and sends each singleton object the appropriate method and passes the application object as the first argument.

Normally, every application has its own execution plan. If the execution plan is calculated at load time of the application class, all objects of this class can share a common execution plan, thus speeding up the requests. Consequently it is recommended to have an initialization in all applications that instantiates an execution plan and passes it to all application objects in the constructor.

ARGUMENTS TO THE CONSTRUCTOR

METHODS

An anonymous array consisting of method names that shall be called when walk() is called. Defaults to

    [qw(header parameter)]
CLASSES

An anonymous array of class names (a.k.a. widgets) that shall be visited when walk() is called. Has no default.

DEBUG

Currently only 0 and 1, 2 or 3 are allowed. If 1, each class/method pair triggers a warning on entering their execution. If 2, the warning is triggered at exit of the subroutine. If 3, both entry and exit trigger a warning.

WATCHVARIABLE

Name of a member variable. Defaults to undef. By setting WATCHVARIABLE you can watch a member variable of the Apache::HeavyCGI object on entering/exiting each call to each class/method pair. Only changes of the variable trigger a warning.

WALKTYPE

A single letter, either m (default) or f. If set to m, all method calls issued by the call to walk() are execute as method calls. If set to f, all method calls are replaced by their equivalent subroutine calls, bypassing perl's method dispatch algorithm. The latter is recommended on the production server, the former is recommended in the development environment. m allows you to use the Apache::StatINC module with the effect it usually has. Using Apache::StatINC with WALKTYPE=f has no effect, as all subroutines are preserved when Apache::StatINC reloads a file, so the execution plan will not note the change.