Gantry::State::Simple - A simple state machine for Gantry


Gantry documentation  | view source Contained in the Gantry distribution.

Index


NAME

Top

Gantry::State::Simple - A simple state machine for Gantry

SYNOPSIS

Top

This module implements a simple state machine to control the execution context within Gantry’s handler() method.

DESCRIPTION

Top

When a request comes into Gantry a pre‐determined set of steps are executed. These pre‐determined steps can be termed "states", and the process can be called a "state machine". There are many ways to implement a "state machine", so this document will not get into the semantics of the term.

What this module does, is allow plugins to issue a redirect and have them take effect immediately. The default behavior is to have the redirect happen after the controllers have finished processing.

This is to allow a plugin to initialize properly. For example Gantry::Plugins::Session requires a redirect to /cookiecheck to see if the session cookie has been set. Under the default state handler, this redirect happens after the initial controller has finished processing.

So a race condition happens. You can not manipulate a session until the cookie has been established which doesn't happen until after the initial controller executes. This problem goes away after the redirect.

This module fixes the problem.

CONFIGURATION

Top

To load a differant state machine you need to do the following:

use MyApp qw{ −StateMachine=Simple };

SEE ALSO

Top

 Gantry
 Gantry::State::Default
 Gantry::State::Constants

AUTHOR

Top

Kevin L. Esteb <kesteb@wsipc.org>

COPYRIGHT AND LICENSE

Top


Gantry documentation  | view source Contained in the Gantry distribution.