Doc patch warning of C<< $c->req->param >>'s fuzzy behavior.
Andrew Rodland [Tue, 16 Jun 2009 18:57:17 +0000 (18:57 +0000)]
lib/Catalyst/Request.pm

index 2a03f7f..429cadb 100644 (file)
@@ -359,6 +359,21 @@ 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>.
 
+B<NOTE> this is considered a legacy interface and care should be taken when
+using it. C<< scalar $c->req->param( 'foo' ) >> will return only the first
+C<foo> param even if multiple are present; C<< $c->req->param( 'foo' ) >> will
+return a list of as many are present, which can have unexpected consequences
+when writing code of the form:
+
+    $foo->bar(
+        a => 'b',
+        baz => $c->req->param( 'baz' ),
+    );
+
+If multiple C<baz> parameters are provided this code might corrupt data or
+cause a hash initialization error. For a more straightforward interface see
+C<< $c->req->parameters >>.
+
 =cut
 
 sub param {