X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FRequest.pm;h=73c6bb34718d169028bd54470450f321ade949b0;hb=8c11318848e17f92027484614d393b6ebd365f7d;hp=0d3b58bb7add73c7912b15119f1ae3f5f77c55dd;hpb=c436c1e8403c86a617686972485f5fef8f801c95;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Request.pm b/lib/Catalyst/Request.pm index 0d3b58b..73c6bb3 100644 --- a/lib/Catalyst/Request.pm +++ b/lib/Catalyst/Request.pm @@ -159,7 +159,7 @@ be either a scalar or an arrayref containing scalars. print $c->request->body_parameters->{field}; print $c->request->body_parameters->{field}->[0]; -These are the paramaters from the POST part of the request, if any. +These are the parameters from the POST part of the request, if any. =item $req->body_params @@ -278,10 +278,19 @@ Contains the request method (C, C, C, etc). Get request parameters with a CGI.pm-compatible param method. This is a method for accessing parameters in $c->req->parameters. - $value = $c->request->param('foo'); - @values = $c->request->param('foo'); + $value = $c->request->param( 'foo' ); + @values = $c->request->param( 'foo' ); @params = $c->request->param; +Like L, and B previous versions of Catalyst, passing multiple +arguments to this method, like this: + + $c->request( 'foo', 'bar', 'gorch', 'quxx' ); + +will set the parameter C to the multiple values C, C and +C. Previously this would have added C as another value to C +(creating it if it didn't exist before), and C as another value for C. + =cut sub param { @@ -310,23 +319,9 @@ sub param { : $self->parameters->{$param}; } } - - if ( @_ > 1 ) { - - while ( my ( $field, $value ) = splice( @_, 0, 2 ) ) { - - next unless defined $field; - - if ( exists $self->parameters->{$field} ) { - for ( $self->parameters->{$field} ) { - $_ = [$_] unless ref($_) eq "ARRAY"; - push( @$_, $value ); - } - } - else { - $self->parameters->{$field} = $value; - } - } + elsif ( @_ > 1 ) { + my $field = shift; + $self->parameters->{$field} = [@_]; } }