[Catalyst-commits] r10551 - Catalyst-Runtime/5.80/trunk/lib/Catalyst

hobbs at dev.catalyst.perl.org hobbs at dev.catalyst.perl.org
Tue Jun 16 18:57:18 GMT 2009


Author: hobbs
Date: 2009-06-16 18:57:17 +0000 (Tue, 16 Jun 2009)
New Revision: 10551

Modified:
   Catalyst-Runtime/5.80/trunk/lib/Catalyst/Request.pm
Log:
Doc patch warning of C<< $c->req->param >>'s fuzzy behavior.


Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Request.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Request.pm	2009-06-16 14:12:30 UTC (rev 10550)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Request.pm	2009-06-16 18:57:17 UTC (rev 10551)
@@ -359,6 +359,21 @@
 (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 {




More information about the Catalyst-commits mailing list