From: Andy Grundman Date: Thu, 1 Dec 2005 19:00:16 +0000 (+0000) Subject: Added a warning if you attempt to retrieve a param using req->params('foo') X-Git-Tag: 5.7099_04~809 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=ee26f4bd0cef4af7cebaf255664024c7bf92bb88 Added a warning if you attempt to retrieve a param using req->params('foo') --- diff --git a/Changes b/Changes index 77d7709..238bbbb 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,8 @@ This file documents the revision history for Perl extension Catalyst. 5.60 - Fixed restarter. + - Added a warning if you attempt to retrieve a parameter + using $c->req->params('foo'). 5.59 2005-11-30 13:25:00 - Fixed shebang line for generated scripts diff --git a/lib/Catalyst/Request.pm b/lib/Catalyst/Request.pm index 3dfbee4..ada6c15 100644 --- a/lib/Catalyst/Request.pm +++ b/lib/Catalyst/Request.pm @@ -329,7 +329,16 @@ Shortcut for $req->parameters. sub parameters { my ( $self, $params ) = @_; $self->{_context}->prepare_body; - $self->{parameters} = $params if $params; + if ( $params ) { + if ( ref $params ) { + $self->{parameters} = $params; + } + else { + $self->{_context}->log->warn( + "Attempt to retrieve '$params' with req->params(), " . + "you probably meant to call req->param('$params')" ); + } + } return $self->{parameters}; }