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 | |
a2c0d071 |
8 | has default_component => ( |
9 | isa => 'Str|Undef', |
10 | is => 'ro', |
11 | required => 0, |
12 | ); |
13 | |
59aacfa7 |
14 | sub get_component { |
77e27f6e |
15 | my ( $self, $name, @args ) = @_; |
4f38bf4b |
16 | |
17 | return $self->resolve( |
18 | service => $name, |
77e27f6e |
19 | parameters => { accept_context_args => \@args }, |
4f38bf4b |
20 | ); |
59aacfa7 |
21 | } |
22 | |
1f90ca59 |
23 | sub get_component_regexp { |
5a53ef3d |
24 | my ( $self, $query, $c, @args ) = @_; |
1f90ca59 |
25 | |
1f90ca59 |
26 | my @result = map { |
77e27f6e |
27 | $self->get_component( $_, $c, @args ) |
ff974a7c |
28 | } grep { m/$query/ } $self->get_service_list; |
1f90ca59 |
29 | |
1f90ca59 |
30 | return @result; |
31 | } |
32 | |
59aacfa7 |
33 | 1; |
4f38bf4b |
34 | |
35 | __END__ |
36 | |
37 | =pod |
38 | |
39 | =head1 NAME |
40 | |
a6c13ff4 |
41 | Catalyst::IOC::SubContainer - Container for models, controllers and views |
4f38bf4b |
42 | |
43 | =head1 METHODS |
44 | |
45 | =head2 get_component |
46 | |
47 | =head2 get_component_regexp |
48 | |
49 | =head1 AUTHORS |
50 | |
51 | Catalyst Contributors, see Catalyst.pm |
52 | |
53 | =head1 COPYRIGHT |
54 | |
55 | This library is free software. You can redistribute it and/or modify it under |
56 | the same terms as Perl itself. |
57 | |
58 | =cut |