# 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
$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.' );
-use Test::More tests => 11;
+use Test::More tests => 14;
use strict;
use warnings;
# 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
-use Test::More tests => 40;
+use Test::More tests => 43;
use strict;
use warnings;
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');
}
{