1 package Catalyst::IOC::SubContainer;
5 extends 'Bread::Board::Container';
7 has default_component => (
11 writer => '_set_default_component',
15 my ( $self, $name, @args ) = @_;
17 return $self->resolve(
19 parameters => { accept_context_args => \@args },
23 sub get_component_regexp {
24 my ( $self, $query, $c, @args ) = @_;
27 $self->get_component( $_, $c, @args )
28 } grep { m/$query/ } $self->get_service_list;
33 # FIXME - is this sub ok?
35 sub make_single_default {
38 my @complist = $self->get_service_list;
40 $self->_set_default_component( shift @complist )
41 if !$self->default_component && scalar @complist == 1;
52 Catalyst::IOC::SubContainer - Container for models, controllers and views
62 Gets the service of the container for the searched component. Also executes
63 the ACCEPT_CONTEXT sub in the component, if it exists.
65 =head2 get_component_regexp
67 Gets all components from container that match a given regexp.
69 =head2 make_single_default
71 If the container has only one component, and no default has been defined,
72 this method makes that one existing service the default.
76 Catalyst Contributors, see Catalyst.pm
80 This library is free software. You can redistribute it and/or modify it under
81 the same terms as Perl itself.