From: Andrew Rodland Date: Tue, 16 Jun 2009 18:57:17 +0000 (+0000) Subject: Doc patch warning of C<< $c->req->param >>'s fuzzy behavior. X-Git-Tag: 5.80006~54 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=83312afd857057c42c753255f804027ce3a76ce9 Doc patch warning of C<< $c->req->param >>'s fuzzy behavior. --- diff --git a/lib/Catalyst/Request.pm b/lib/Catalyst/Request.pm index 2a03f7f..429cadb 100644 --- a/lib/Catalyst/Request.pm +++ b/lib/Catalyst/Request.pm @@ -359,6 +359,21 @@ 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. +B 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 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 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 {