
Maypole - MVC web application framework

See Maypole::Application.

This documents the Maypole request object. See the Maypole::Manual, for a detailed guide to using Maypole.
Maypole is a Perl web application framework to Java's struts. It is essentially completely abstracted, and so doesn't know anything about how to talk to the outside world.
To use it,
you need to create a package which represents your entire application.
In our example above,
this is the BeerDB package.
This needs to first use Maypole::Application which will make your package inherit from the appropriate platform driver such as Apache::MVC or CGI::Maypole,
and then call setup.
This sets up the model classes and configures your application.
The default model class for Maypole uses Class::DBI to map a database to classes,
but this can be changed by altering configuration.
(Before calling setup.)
Returns the Maypole::Config object
My::App->setup($data_source, $user, $password, \%attr);
Initialise the maypole application and model classes. Your application should call this after setting configuration via "config"
You should not call this directly, but you may wish to override this to add application-specific initialisation.
Get/set the Maypole::View object
sub My::App::debug {1}
Returns the debugging flag. Override this in your application class to enable/disable debugging.
Turns the backend request (e.g. Apache::MVC, Maypole, CGI) into a Maypole request. It does this by setting the path, and invoking parse_path and parse_args.
You should only need to define this method if you are writing a new Maypole backend.
Returns the request path
Parses the request path and sets the args, action and table properties
The table part of the Maypole request path
The action part of the Maypole request path
A list of remaining parts of the request path after table and action have been removed
A Maypole::Headers object containing HTTP headers for the request
A HTTP::Headers object that contains HTTP headers for the output
Turns post data and query string paramaters into a hash of params.
You should only need to define this method if you are writing a new Maypole backend.
An accessor for request parameters. It behaves similarly to CGI::param() for accessing CGI parameters.
Returns a hash of request parameters. The source of the parameters may vary depending on the Maypole backend, but they are usually populated from request query string and POST data.
Note: Where muliple values of a parameter were supplied, the params value will be an array reference.
Implementation-specific path to template root.
You should only need to define this method if you are writing a new Maypole backend. Otherwise, see "template_root" in Maypole::Config
You should only need to define this method if you are writing a new Maypole backend. It should return something that looks like an Apache or CGI request object, it defaults to blank.
Returns a Maypole::Constant to indicate whether the request is valid.
The default implementation checks that $r->table is publicly accessible and that the model class is configured to handle the $r->action
Returns a Maypole::Constant to indicate whether the user is authenticated for the Maypole request.
The default implementation returns OK
Returns the perl package name that will serve as the model for the request. It corresponds to the request table attribute.
Called before the model processes the request, this method gives you a chance to do some processing for each request, for example, manipulating template_args.
Get/set a list of model objects. The objects will be accessible in the view templates.
If the first item in $r->args can be retrieve()d by the model class, it will be removed from args and the retrieved object will be added to the objects list. See Maypole::Model for more information.
$r->template_args->{foo} = 'bar';
Get/set a hash of template variables.
Get/set the template to be used by the view. By default, it returns $r->action
This method is called if any exceptions are raised during the authentication or model/view processing. It should accept the exception as a parameter and return a Maypole::Constant to indicate whether the request should continue to be processed.
Get/set a request error
Get/set the response output. This is usually populated by the view class. You can skip view processing by setting the output.
Get/set the output encoding. Default: utf-8.
Get/set the output content type. Default: text/html
Sends the output and additional headers to the user.
This method first checks if the relevant model class can authenticate the user, or falls back to the default authenticate method of your Maypole application.
This model is called to catch exceptions, first after authenticate, then after processing the model class, and finally to check for exceptions from the view class.
This method first checks if the relevant model class can handle exceptions the user, or falls back to the default exception method of your Maypole application.
This method sets up the class if it's not done yet, sets some defaults and leaves the dirty work to handler_guts.
This is the core of maypole. You don't want to know.

There's more documentation, examples, and a information on our mailing lists at the Maypole web site:
Maypole::Application, Apache::MVC, CGI::Maypole.

Maypole is currently maintained by Simon Flack simonflk#cpan.org

Simon Cozens, simon#cpan.org
Sebastian Riedel, sri#oook.de maintained Maypole from 1.99_01 to 2.04

Sebastian Riedel, Danijel Milicevic, Dave Slack, Jesse Sheidlower, Jody Belka, Marcus Ramberg, Mickael Joanne, Randal Schwartz, Simon Flack, Steve Simms, Veljko Vidovic and all the others who've helped.

You may distribute this code under the same terms as Perl itself.