$config->uri_base("http://localhost/beerdb");
$config->template_root("/path/to/templates");
$config->rows_per_page(10);
- $config->display_tables([qw[beer brewery pub style]]);
+ $config->display_tables([qw/beer brewery pub style/]);
# table relationships
$config->relationships([
__PACKAGE__->mk_accessors(
qw( params query objects model_class template_args output path
args action template error document_encoding content_type table
- headers_in headers_out stash session)
+ headers_in headers_out stash session user)
);
__PACKAGE__->config( Maypole::Config->new() );
As a framework, Maypole provides a number of B<hooks> - methods that are
intended to be overridden. Some of these methods come with useful default
-behaviour, others do nothing by default. Likely hooks include:
+behaviour, others do nothing by default. Hooks include:
Class methods
-------------
$self->get_request($req);
$self->parse_location;
- # hook useful for declining static requests e.g. images
+ # hook useful for declining static requests e.g. images, or perhaps for
+ # sanitizing request parameters
my $status = $self->start_request_hook;
return $status unless $status == Maypole::Constants::OK();
$self->session($self->get_session);
+ $self->user($self->get_user);
$status = $self->handler_guts;
=item get_session
+Called immediately after C<start_request_hook()>.
+
+This method should return a session, which will be stored in the request's
+C<session> attribute.
+
The default method is empty.
=cut
sub get_session { }
+=item get_user
+
+Called immediately after C<get_session>.
+
+This method should return a user, which will be stored in the request's C<user>
+attribute.
+
+The default method is empty.
+
+=cut
+
+sub get_user {}
+
=item call_authenticate
This method first checks if the relevant model class
| | |
|-----+ init | |
||<---+ | |
- || | new | view_object: e.g
+ || | new | view_object: e.g.
||---------------------------------------------> Maypole::View::TT
| | | |
| | | |
| ||-----+ get_session | | |
| |||<---+ | | |
| || | | |
+ | ||-----+ get_user | | |
+ | |||<---+ | | |
+ | || | | |
| ||-----+ handler_guts | | |
| |||<---+ | | |
| ||| class_of($table) | | |
| ||| | | |
| |||-----+ additional_data | | |
| ||||<---+ | | |
- | ||| process | | fetch_objects
- | |||--------------------------------->||-----+ |
+ | ||| process | | |
+ | |||--------------------------------->|| fetch_objects
+ | ||| | ||-----+ |
| ||| | |||<---+ |
| ||| | || |
| ||| | || $action
| ||| | ||-----+ |
- | ||| | |||<---+ |
- | ||| | | |
+ | ||| | |||<---+ |
| ||| process | | |
| |||------------------------------------------->|| template
| ||| | | ||-----+