1 package Catalyst::IOC::SubContainer;
5 extends 'Bread::Board::Container';
7 has default_component => (
10 builder => '_build_default_component',
14 sub _build_default_componentt {
17 my @complist = $self->get_service_list;
19 scalar @complist == 1 ? $complist[0] : undef;
24 my ( $self, $name, @args ) = @_;
26 return $self->resolve(
28 parameters => { accept_context_args => \@args },
32 sub get_component_regexp {
33 my ( $self, $query, $c, @args ) = @_;
36 $self->get_component( $_, $c, @args )
37 } grep { m/$query/ } $self->get_service_list;
50 Catalyst::IOC::SubContainer - Container for models, controllers and views
60 Gets the service of the container for the searched component. Also executes
61 the ACCEPT_CONTEXT sub in the component, if it exists.
63 =head2 get_component_regexp
65 Gets all components from container that match a given regexp.
67 =head2 make_single_default
69 If the container has only one component, and no default has been defined,
70 this method makes that one existing service the default.
74 Catalyst Contributors, see Catalyst.pm
78 This library is free software. You can redistribute it and/or modify it under
79 the same terms as Perl itself.