Fixed docs for comp()
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Request.pm
index f0732ab..cd8d20c 100644 (file)
@@ -123,16 +123,16 @@ then C<base> is C<http://localhost:3000/>.
 
 sub base {
     my ( $self, $base ) = @_;
-    
+
     return $self->{base} unless $base;
-    
+
     $self->{base} = $base;
-    
+
     # set the value in path for backwards-compat
     if ( $self->uri ) {
         $self->path;
     }
-    
+
     return $self->{base};
 }
 
@@ -278,10 +278,19 @@ Contains the request method (C<GET>, C<POST>, C<HEAD>, 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<CGI>, and B<unlike> previous versions of Catalyst, passing multiple
+arguments to this method, like this:
+
+       $c->request( 'foo', 'bar', 'gorch', 'quxx' );
+
+will set the parameter C<foo> to the multiple values C<bar>, C<gorch> and
+C<quxx>. Previously this would have added C<bar> as another value to C<foo>
+(creating it if it didn't exist before), and C<quxx> as another value for C<gorch>.
+
 =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} = [@_];
     }
 }
 
@@ -507,7 +502,7 @@ Returns a URI object for the request.
 
 =item $req->user
 
-Contains the user name of user if authentication check was successful.
+Returns the user.
 
 =item $req->user_agent