__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)
+ headers_in headers_out stash session)
);
__PACKAGE__->config( Maypole::Config->new() );
__PACKAGE__->init_done(0);
my $applicable = $self->is_model_applicable;
$self->__setup_plain_template unless $applicable;
+
+ $self->session($self->call_get_session);
- # We authenticate every request, needed for proper session management
my $status;
-
+
eval { $status = $self->call_authenticate };
if ( my $error = $@ )
return $self->authenticate($self);
}
+sub call_get_session {
+ my ($self) = @_;
+ return $self->get_session($self);
+}
+
sub call_exception
{
my ($self, $error) = @_;
sub authenticate { return OK }
+sub get_session { }
+
sub exception { return ERROR }
+sub preprocess_path { };
+
sub parse_path
{
my ($self) = @_;
+ $self->preprocess_path;
+
$self->path || $self->path('frontpage');
my @pi = grep {length} split '/', $self->path;
- $self->table(shift @pi);
+ $self->table || $self->table(shift @pi);
- $self->action( shift @pi or 'index' );
+ $self->action || $self->action( shift @pi or 'index' );
- $self->args(\@pi);
+ $self->args || $self->args(\@pi);
}
=head3 parse_path
-Parses the request path and sets the C<args>, C<action> and C<table>
-properties
+Parses the request path and sets the C<args>, C<action> and C<table>
+properties. Calls preprocess_path before parsing path and setting properties.
=head3 make_path( %args or \%args or @args )
expanded into extra path elements, whereas a hashref is translated into a query
string.
+=head3 preprocess_path
+
+Sometimes when you don't want to rewrite or over-ride parse_path but
+want to rewrite urls or extract data from them before it is parsed.
+
+This method is called after parse_location has populated the request
+information and before parse_path has populated the model and action
+information, and is passed the request object.
+
+You can set action, args or table in this method and parse_path will
+then leave those values in place or populate them if not present
+
=head3 make_uri( @segments )
Make a L<URI> object given table, action etc. Automatically adds
=head1 AUTHOR
-Maypole is currently maintained by Simon Flack C<simonflk#cpan.org>
+Maypole is currently maintained by Aaron Trevena
=head1 AUTHOR EMERITUS