is => 'rw',
required => 1,
lazy => 1,
- default => sub { {} },
+ builder => 'prepare_body_parameters',
);
has uploads => (
sub prepare_parameters {
my ( $self ) = @_;
-
- $self->prepare_body;
my $parameters = {};
my $body_parameters = $self->body_parameters;
my $query_parameters = $self->query_parameters;
$parameters;
}
-before body_parameters => sub {
- my ($self) = @_;
- $self->prepare_body;
- $self->prepare_body_parameters;
-};
-
has _uploadtmp => (
is => 'ro',
predicate => '_has_uploadtmp',
sub prepare_body_parameters {
my ( $self ) = @_;
+ $self->prepare_body if ! $self->_has_body;
return unless $self->_body;
- $self->{body_parameters} = $self->_body->param; # FIXME!! Recursion here.
+ return $self->_body->param;
}
sub prepare_connection {
# and provide a custom reader..
sub body {
my $self = shift;
- $self->prepare_body();
+ $self->prepare_body unless ! $self->_has_body;
croak 'body is a reader' if scalar @_;
return blessed $self->_body ? $self->_body->body : $self->_body;
}
sub query_params { shift->query_parameters(@_) }
sub path_info { shift->path(@_) }
-=for stopwords param params snippets
+=for stopwords param params
=head1 NAME
Sets up parameters from body.
-=head2 $self->prepare_cookies($c)
+=head2 $self->prepare_cookies()
Parse cookies from header. Sets up a L<CGI::Simple::Cookie> object.
+=head2 $self->prepare_connection()
+
+Sets up various fields in the request like the local and remote addresses,
+request method, hostname requested etc.
+
+=head2 $self->prepare_parameters()
+
+Ensures that the body has been parsed, then builds the parameters, which are
+combined from those in the request and those in the body.
+
+This method is the builder for the 'parameters' attribute.
+
=head2 meta
Provided by Moose