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