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