Bugfix for 5.8 regression found in C::C::DBIC::API
Tomas Doran [Mon, 20 Apr 2009 18:39:26 +0000 (18:39 +0000)]
Changes
lib/Catalyst/Request.pm

diff --git a/Changes b/Changes
index a601b19..fd8b2eb 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,9 +1,11 @@
 # This file documents the revision history for Perl extension Catalyst.
 
+        - Fix so that calling $c->req->parameters(undef) does not flatten
+          the request parameters with undef + test (t0m)
         - Fix so that width of table of unattached actions for debugging
-          ::DispatchType::Chained varies according to your terminal width 
+          ::DispatchType::Chained varies according to your terminal width
           (Oleg Kostyuk)
-        - Fix warning message about linearized @ISA in Catalyst::Component 
+        - Fix warning message about linearized @ISA in Catalyst::Component
           (Emanuele Zeppieri)
         - Require MX::MethodAttributes 0.06 to avoid issues with saying
           use base 'Catalyst::Controller'; use Moose; losing actions (t0m)
index c859fd2..4f9d7dc 100644 (file)
@@ -76,15 +76,19 @@ has parameters => (
   default => sub { {} },
 );
 
-before parameters => sub {
-  my ($self, $params) = @_;
-  if ( $params && !ref $params ) {
-    $self->_context->log->warn(
-        "Attempt to retrieve '$params' with req->params(), " .
-        "you probably meant to call req->param('$params')" );
-    $params = undef;
-  }
-
+around parameters => sub {
+    my ($orig, $self, $params) = @_;
+    if ($params) {
+        if ( !ref $params ) {
+            $self->_context->log->warn(
+                "Attempt to retrieve '$params' with req->params(), " .
+                "you probably meant to call req->param('$params')"
+            );
+            $params = undef;
+        }
+        return $self->$orig($params);
+    }
+    $self->$orig();
 };
 
 has base => (