068f379d0eb6ebdedfe98faa466b9e294ade2be5
[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     my @result = map {
21         $self->get_component( $_, $c, @args )
22     } grep { m/$query/ } $self->get_service_list;
23
24     return @result;
25 }
26
27 1;
28
29 __END__
30
31 =pod
32
33 =head1 NAME
34
35 Catalyst::IOC::SubContainer - Container for models, controllers and views
36
37 =head1 METHODS
38
39 =head2 get_component
40
41 =head2 get_component_regexp
42
43 =head1 AUTHORS
44
45 Catalyst Contributors, see Catalyst.pm
46
47 =head1 COPYRIGHT
48
49 This library is free software. You can redistribute it and/or modify it under
50 the same terms as Perl itself.
51
52 =cut