[Catalyst-commits] r8136 - in Catalyst-Runtime/5.70/trunk: . lib t
bricas at dev.catalyst.perl.org
bricas at dev.catalyst.perl.org
Fri Jul 18 02:21:07 BST 2008
Author: bricas
Date: 2008-07-18 02:21:07 +0100 (Fri, 18 Jul 2008)
New Revision: 8136
Modified:
Catalyst-Runtime/5.70/trunk/Changes
Catalyst-Runtime/5.70/trunk/lib/Catalyst.pm
Catalyst-Runtime/5.70/trunk/t/unit_core_component.t
Catalyst-Runtime/5.70/trunk/t/unit_core_mvc.t
Log:
more fixes to regexp fallback, ugh.
Modified: Catalyst-Runtime/5.70/trunk/Changes
===================================================================
--- Catalyst-Runtime/5.70/trunk/Changes 2008-07-18 00:01:14 UTC (rev 8135)
+++ Catalyst-Runtime/5.70/trunk/Changes 2008-07-18 01:21:07 UTC (rev 8136)
@@ -1,7 +1,7 @@
# This file documents the revision history for Perl extension Catalyst.
5.7xxxxxx XXXX
- - Fix regression for regexp fallback in model(), view() and controller()
+ - Fix regressions for regexp fallback in model(), view() and controller()
5.7099_02 2008-07-16 19:10:00
- Added PathPrefix attribute
Modified: Catalyst-Runtime/5.70/trunk/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.70/trunk/lib/Catalyst.pm 2008-07-18 00:01:14 UTC (rev 8135)
+++ Catalyst-Runtime/5.70/trunk/lib/Catalyst.pm 2008-07-18 01:21:07 UTC (rev 8136)
@@ -454,6 +454,11 @@
$query = qr/$name/i;
@result = map { $c->components->{ $_ } } grep { $eligible{ $_ } =~ m{$query} } keys %eligible;
+ # no results? try against full names
+ if( !@result ) {
+ @result = map { $c->components->{ $_ } } grep { m{$query} } keys %eligible;
+ }
+
# don't warn if we didn't find any results, it just might not exist
if( @result ) {
$c->log->warn( 'Relying on the regexp fallback behavior for component resolution is unreliable and unsafe.' );
Modified: Catalyst-Runtime/5.70/trunk/t/unit_core_component.t
===================================================================
--- Catalyst-Runtime/5.70/trunk/t/unit_core_component.t 2008-07-18 00:01:14 UTC (rev 8135)
+++ Catalyst-Runtime/5.70/trunk/t/unit_core_component.t 2008-07-18 01:21:07 UTC (rev 8136)
@@ -1,4 +1,4 @@
-use Test::More tests => 11;
+use Test::More tests => 14;
use strict;
use warnings;
@@ -41,6 +41,9 @@
# regexp behavior
{
is_deeply( [ MyApp->comp( qr{Model} ) ], [ 'MyApp::M::Model'], 'regexp ok' );
+ is_deeply( [ MyApp->comp('MyApp::V::View$') ], [ 'MyApp::V::View' ], 'Explicit return ok');
+ is_deeply( [ MyApp->comp('MyApp::C::Controller$') ], [ 'MyApp::C::Controller' ], 'Explicit return ok');
+ is_deeply( [ MyApp->comp('MyApp::M::Model$') ], [ 'MyApp::M::Model' ], 'Explicit return ok');
}
# multiple returns
Modified: Catalyst-Runtime/5.70/trunk/t/unit_core_mvc.t
===================================================================
--- Catalyst-Runtime/5.70/trunk/t/unit_core_mvc.t 2008-07-18 00:01:14 UTC (rev 8135)
+++ Catalyst-Runtime/5.70/trunk/t/unit_core_mvc.t 2008-07-18 01:21:07 UTC (rev 8136)
@@ -1,4 +1,4 @@
-use Test::More tests => 40;
+use Test::More tests => 43;
use strict;
use warnings;
@@ -121,6 +121,9 @@
ok( $warnings, 'regexp fallback warnings' );
}
+ is_deeply( [ MyApp->view('MyApp::V::View$') ], [ 'MyApp::V::View' ], 'Explicit return ok');
+ is_deeply( [ MyApp->controller('MyApp::C::Controller$') ], [ 'MyApp::C::Controller' ], 'Explicit return ok');
+ is_deeply( [ MyApp->model('MyApp::M::Model$') ], [ 'MyApp::M::Model' ], 'Explicit return ok');
}
{
More information about the Catalyst-commits
mailing list