[Catalyst-commits] r8135 - in Catalyst-Runtime/5.70/trunk: . lib t

bricas at dev.catalyst.perl.org bricas at dev.catalyst.perl.org
Fri Jul 18 01:01:15 BST 2008


Author: bricas
Date: 2008-07-18 01:01:14 +0100 (Fri, 18 Jul 2008)
New Revision: 8135

Modified:
   Catalyst-Runtime/5.70/trunk/Changes
   Catalyst-Runtime/5.70/trunk/lib/Catalyst.pm
   Catalyst-Runtime/5.70/trunk/t/unit_core_mvc.t
Log:
Fix regression for regexp fallback in model(), view() and controller()

Modified: Catalyst-Runtime/5.70/trunk/Changes
===================================================================
--- Catalyst-Runtime/5.70/trunk/Changes	2008-07-17 15:33:07 UTC (rev 8134)
+++ Catalyst-Runtime/5.70/trunk/Changes	2008-07-18 00:01:14 UTC (rev 8135)
@@ -1,5 +1,8 @@
 # This file documents the revision history for Perl extension Catalyst.
 
+5.7xxxxxx XXXX
+        - Fix regression for regexp fallback in model(), view() and controller()
+
 5.7099_02 2008-07-16 19:10:00
         - Added PathPrefix attribute
         - Removed Catalyst::Build; we've long since moved to Module::Install

Modified: Catalyst-Runtime/5.70/trunk/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.70/trunk/lib/Catalyst.pm	2008-07-17 15:33:07 UTC (rev 8134)
+++ Catalyst-Runtime/5.70/trunk/lib/Catalyst.pm	2008-07-18 00:01:14 UTC (rev 8135)
@@ -452,7 +452,7 @@
 
     # regexp fallback
     $query  = qr/$name/i;
-    @result = grep { $eligible{ $_ } =~ m{$query} } keys %eligible;
+    @result = map { $c->components->{ $_ } } grep { $eligible{ $_ } =~ m{$query} } keys %eligible;
 
     # don't warn if we didn't find any results, it just might not exist
     if( @result ) {

Modified: Catalyst-Runtime/5.70/trunk/t/unit_core_mvc.t
===================================================================
--- Catalyst-Runtime/5.70/trunk/t/unit_core_mvc.t	2008-07-17 15:33:07 UTC (rev 8134)
+++ Catalyst-Runtime/5.70/trunk/t/unit_core_mvc.t	2008-07-18 00:01:14 UTC (rev 8135)
@@ -1,4 +1,4 @@
-use Test::More tests => 37;
+use Test::More tests => 40;
 use strict;
 use warnings;
 
@@ -107,6 +107,20 @@
     is_deeply( [ MyApp->view( qr{^V[ie]+w$} ) ], [ 'MyApp::V::View' ], 'regexp view ok' );
     is_deeply( [ MyApp->controller( qr{Dummy\::Model$} ) ], [ 'MyApp::Controller::Model::Dummy::Model' ], 'regexp controller ok' );
     is_deeply( [ MyApp->model( qr{Dum{2}y} ) ], [ 'MyApp::Model::Dummy::Model' ], 'regexp model ok' );
+    
+    # ACCEPT_CONTEXT w/ qr{}
+    is_deeply( [ MyApp->model( qr{Test} ) ], [ MyApp->components->{'MyApp::Model::Test::Object'} ], 'Object returned' );
+
+    {
+        my $warnings = 0;
+        no warnings 'redefine';
+        local *Catalyst::Log::warn = sub { $warnings++ };
+
+        # ACCEPT_CONTEXT w/ regexp fallback
+        is_deeply( [ MyApp->model( 'Test' ) ], [ MyApp->components->{'MyApp::Model::Test::Object'} ], 'Object returned' );
+        ok( $warnings, 'regexp fallback warnings' );
+    }
+
 }
 
 {




More information about the Catalyst-commits mailing list