Commit | Line | Data |
a6c13ff4 |
1 | package Catalyst::IOC::SubContainer; |
59aacfa7 |
2 | use Bread::Board; |
3 | use Moose; |
a6c13ff4 |
4 | use Catalyst::IOC::BlockInjection; |
59aacfa7 |
5 | |
6 | extends 'Bread::Board::Container'; |
7 | |
8 | sub 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 |
17 | sub 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 |
32 | 1; |
4f38bf4b |
33 | |
34 | __END__ |
35 | |
36 | =pod |
37 | |
38 | =head1 NAME |
39 | |
a6c13ff4 |
40 | Catalyst::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 | |
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 |