removed regexp fallback
[catagits/Catalyst-Runtime.git] / lib / Catalyst / IOC / SubContainer.pm
CommitLineData
a6c13ff4 1package Catalyst::IOC::SubContainer;
59aacfa7 2use Bread::Board;
3use Moose;
a6c13ff4 4use Catalyst::IOC::BlockInjection;
59aacfa7 5
6extends 'Bread::Board::Container';
7
8sub get_component {
77e27f6e 9 my ( $self, $name, @args ) = @_;
4f38bf4b 10
11 return $self->resolve(
12 service => $name,
77e27f6e 13 parameters => { accept_context_args => \@args },
4f38bf4b 14 );
59aacfa7 15}
16
1f90ca59 17sub get_component_regexp {
5a53ef3d 18 my ( $self, $query, $c, @args ) = @_;
1f90ca59 19
5a53ef3d 20 if (!ref $query) {
21 $c->log->warn("Looking for '$query', but nothing was found.");
22 return;
23 }
1f90ca59 24
1f90ca59 25 my @result = map {
77e27f6e 26 $self->get_component( $_, $c, @args )
ff974a7c 27 } grep { m/$query/ } $self->get_service_list;
1f90ca59 28
1f90ca59 29 return @result;
30}
31
59aacfa7 321;
4f38bf4b 33
34__END__
35
36=pod
37
38=head1 NAME
39
a6c13ff4 40Catalyst::IOC::SubContainer - Container for models, controllers and views
4f38bf4b 41
42=head1 METHODS
43
44=head2 get_component
45
46=head2 get_component_regexp
47
48=head1 AUTHORS
49
50Catalyst Contributors, see Catalyst.pm
51
52=head1 COPYRIGHT
53
54This library is free software. You can redistribute it and/or modify it under
55the same terms as Perl itself.
56
57=cut