__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 status parent)
+ headers_in headers_out stash status parent build_form_elements)
);
__PACKAGE__->config( Maypole::Config->new() );
config => $class->config,
}, $class;
- $self->stash({});
- $self->params({});
- $self->query({});
- $self->template_args({});
- $self->args([]);
- $self->objects([]);
-
+ $self->stash({});
+ $self->params({});
+ $self->query({});
+ $self->template_args({});
+ $self->args([]);
+ $self->objects([]);
return $self;
}
$self->get_user;
my $url = URI->new($path);
- warn "path : $path\n";
$self->{path} = $url->path;
$self->parse_path;
$self->params( $url->query_form_hash );
This is the main request handling method and calls various methods to handle the
request/response and defines the workflow within Maypole.
-B<Currently undocumented and liable to be refactored without warning>.
-
=cut
# The root of all evil
sub handler_guts
{
my ($self) = @_;
-
+ $self->build_form_elements(1);
$self->__load_request_model;
my $applicable = $self->is_model_applicable == OK;
return $status;
}
+=item warn
+
+$r->warn('its all gone pete tong');
+
+Warn must be implemented by the backend, i.e. Apache::MVC
+and warn to stderr or appropriate logfile.
+
+You can also over-ride this in your Maypole driver, should you
+want to use something like Log::Log4perl instead.
+
+=cut
+
+sub warn { }
+
+=item build_form_elements
+
+$r->build_form_elements(0);
+
+Specify whether to build HTML form elements and populate
+the cgi element of classmetadata.
+
+=cut
+
=item get_request
You should only need to define this method if you are writing a new
if (not $ok)
{
- warn "We don't have that table ($table).\n"
+ $self->warn ("We don't have that table ($table).\n"
. "Available tables are: "
- . join( ",", keys %$ok_tables )
+ . join( ",", keys %$ok_tables ))
if $self->debug and not $ok_tables->{$table};
return DECLINED;
my $action = $self->action;
return OK if $self->model_class->is_public($action);
- warn "The action '$action' is not applicable to the table '$table'"
+ $self->warn("The action '$action' is not applicable to the table '$table'")
if $self->debug;
return DECLINED;
my @pi = grep {length} split '/', $self->path;
-
$self->table || $self->table(shift @pi);
$self->action || $self->action( shift @pi or 'index' );
$self->args || $self->args(\@pi);