I have some older code that calls $c->prepare_parameters after making some
modification to the request. If that's an acceptable use is questionable,
but we have a change in behavior regardless from 5.90007 to 5.90008-TRIAL.
Essentially, now if you do some thing a bit odd like this:
$c->req->parameters( {} );
$c->prepare_parameters;
Then $c->req->parameters stays an empty hash. Previous to 5.90008-TRIAL
this would prepare the parameters again.
The documentation in C::Engine says:
> =head2 $self->prepare_parameters($c)
> sets up parameters from query and post parameters.
which is only true now when $req->parameters has not already been called.
And in 5.90008-TRIAL the prepare_parameters was moved to Catalyst::Request,
with the documentation:
=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.
What it doesn't do any more is set $c->req->parameters when called
directly, only when called as a builder.
I don't think prepare_parameters should be both a builder AND a method.
What about this approach:
Change the Request parameters attribute to have a builder and a clearer:
has parameters => (
is => 'rw',
lazy => 1,
builder => '_build_parameters',
clearer => 'clear_parameters',
);
Then rename the existing "prepare_parameters" to "_build_parameters",
because that's what it is, and then add a new method:
sub prepare_parameters {
my $self = shift;
$self->clear_parameters;
return $self->parameters;
}
And likewise in the Engine.pm:
sub prepare_parameters {
my ( $self, $c ) = @_;
$c->request->clear_parameters;
return $c->request->parameters;
}
--
Bill Moseley
[email protected]
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/