X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FRequest.pm;h=b8d05b4cd2edf9b21a9aac60c2cfacaf4b27379f;hp=d0df0f0dad87416df338b0353cdd61b5404b3da2;hb=d0cacee71a316290bc01f0e12681c16bdc1e84e2;hpb=3a526ce8805d85f0214f134af2e0a4bb107dd2d4 diff --git a/lib/Catalyst/Request.pm b/lib/Catalyst/Request.pm index d0df0f0..b8d05b4 100644 --- a/lib/Catalyst/Request.pm +++ b/lib/Catalyst/Request.pm @@ -23,13 +23,15 @@ has user => (is => 'rw'); sub snippets { shift->captures(@_) } has _read_position => ( - init_arg => undef, + # FIXME: work around Moose bug RT#75367 + # init_arg => undef, is => 'ro', writer => '_set_read_position', default => 0, ); has _read_length => ( - init_arg => undef, + # FIXME: work around Moose bug RT#75367 + # init_arg => undef, is => 'ro', default => sub { my $self = shift; @@ -139,7 +141,8 @@ has uploads => ( has parameters => ( is => 'rw', lazy => 1, - builder => 'prepare_parameters', + builder => '_build_parameters', + clearer => '_clear_parameters', ); # TODO: @@ -152,6 +155,14 @@ has parameters => ( sub prepare_parameters { my ( $self ) = @_; + $self->_clear_parameters; + return $self->parameters; +} + + + +sub _build_parameters { + my ( $self ) = @_; my $parameters = {}; my $body_parameters = $self->body_parameters; my $query_parameters = $self->query_parameters; @@ -218,7 +229,7 @@ sub prepare_body_parameters { my ( $self ) = @_; $self->prepare_body if ! $self->_has_body; - return unless $self->_body; + return {} unless $self->_body; return $self->_body->param; } @@ -868,7 +879,8 @@ request method, hostname requested etc. 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. +If parameters have already been set will clear the parameters and build them again. + =head2 meta