1 package Catalyst::IOC::SubContainer;
4 use Catalyst::IOC::BlockInjection;
6 extends 'Bread::Board::Container';
8 has disable_regex_fallback => (
15 my ( $self, $name, @args ) = @_;
17 return $self->resolve(
19 parameters => { accept_context_args => \@args },
23 sub get_component_regexp {
24 my ( $self, $name, $c, @args ) = @_;
27 if $self->disable_regex_fallback && !ref $name;
29 my $query = ref $name ? $name : qr{$name}i;
30 my $appname = $self->parent->name;
31 $query =~ s/^${appname}:://i;
32 $query =~ s/[MVC]|(Model|View|Controller):://i;
35 $self->get_component( $_, $c, @args )
36 } grep { m/$query/ } $self->get_service_list;
38 if (!ref $name && $result[0]) {
39 $c->log->warn( Carp::shortmess(qq(Found results for "${name}" using regexp fallback)) );
40 $c->log->warn( 'Relying on the regexp fallback behavior for component resolution' );
41 $c->log->warn( 'is unreliable and unsafe. You have been warned' );
56 Catalyst::IOC::SubContainer - Container for models, controllers and views
62 =head2 get_component_regexp
66 Catalyst Contributors, see Catalyst.pm
70 This library is free software. You can redistribute it and/or modify it under
71 the same terms as Perl itself.