Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Gantry::State::DefaultUser Contributed Perl DocumentaGantry::State::Default(3)

NAME
       Gantry::State::Default -	Default	state handler for Gantry

SYNOPSIS
       This module implements the default handler to control the execution
       context within GantryXs handler() method.

DESCRIPTION
       When a request comes into Gantry	a preXdetermined set of	steps are
       executed.  These	preXdetermined 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 take Gantry's default handling	of a request,
       and places it into a loadable module. With these	"states" now in	a
       loadable	module,	you can	change the execution order to suit your
       applications needs.

       Why is this desirable?

       LetXs say you have an application the loads some	plugins, those plugins
       must do a relocation for	proper initialization and this relocation must
       be done before the controllers can execute properly. Or you want	"hook"
       processing, using per and post "hook" plugins. With the default
       handler,	this is	not possible, with a loadable "state machine" this is
       now quite easy to do.

       This module also	moves the methods relocate() and
       relocate_permanently() from Gantry.pm into this module.

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

	   use MyApp qw{ XStateMachine=Machine };

METHODS
       state_run
	   This	method is where	the logic goes for your	handler. It will
	   receive two paramters:

	    r_or_cgi	      This is passed into GantryXs handler() method
			      and is determined	by the execution environment
			      that Gantry is running within (CGI, MP13,	MP20).

	    plugin_callbacks  This is determined by Gantry at runtime.

	   Example:

	    sub	state_run {
		my ($self, $r_or_cgi, $plugin_callbacks) = @_;

		# your code goes here

	    }

       state_engine
	   This	method returns the name	of the state machine.

	   $name = $selfX>state_engine;

       relocate
	   This	method can be called from any controller and will relocate the
	   user	to the given location.

	   $selfX>relocate( location );

       relocate_permanently
	   This	method can be called from any controller and will relocate the
	   user	to the given location using HTTP_MOVED_PERMANENTLY 301.

	   $selfX>relocate_permanently(	location );

SEE ALSO
       Gantry

AUTHOR
       Kevin L.	Esteb <kesteb@wsipc.org>

COPYRIGHT AND LICENSE
       Copyright (C) 2008 Kevin	L. Esteb

       This library is free software; you can redistribute it and/or modify it
       under the same terms as Perl itself, either Perl	version	5.8.6 or, at
       your option, any	later version of Perl 5	you may	have available.

POD ERRORS
       Hey! The	above document had some	coding errors, which are explained
       below:

       Around line 242:
	   Non-ASCII character seen before =encoding in	'GantryXs'. Assuming
	   UTF-8

perl v5.24.1			  2017-07-02	     Gantry::State::Default(3)

NAME | SYNOPSIS | DESCRIPTION | CONFIGURATION | METHODS | SEE ALSO | AUTHOR | COPYRIGHT AND LICENSE | POD ERRORS

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Gantry::State::Default&sektion=3&manpath=FreeBSD+12.1-RELEASE+and+Ports>

home | help