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