my $container = $class->container;
for my $component (@comps) {
- my $instance = $container->add_component( $component, $class );
- my @expanded_components = $instance->can('expand_modules')
- ? $instance->expand_modules( $component, $config )
- : $class->expand_component_module( $component, $config );
+ $container->add_component( $component, $class );
+# FIXME - $instance->expand_modules() is broken
+ my @expanded_components = $class->expand_component_module( $component, $config );
for my $component (@expanded_components) {
next if $comps{$component};
return unless $type;
- my $instance = setup_component( $component, $class );
-
$self->get_sub_container($type)->add_service(
Catalyst::IOC::BlockInjection->new(
name => $name,
- block => sub { $instance },
+ block => sub { $self->setup_component( $component, $class ) },
)
);
-
- return $instance;
}
# FIXME: should this sub exist?
# FIXME ugly and temporary
# Just moved it here the way it was, so we can work on it here in the container
sub setup_component {
- my ( $component, $class ) = @_;
+ my ( $self, $component, $class ) = @_;
unless ( $component->can( 'COMPONENT' ) ) {
return $component;
# FIXME I know this isn't the "Dependency Injection" way of doing things,
# its just temporary
my $suffix = Catalyst::Utils::class2classsuffix( $component );
- my $config = $class->config->{ $suffix } || {};
+ my $config = $self->resolve(service => 'config')->{ $suffix } || {};
# Stash catalyst_component_name in the config here, so that custom COMPONENT
# methods also pass it. local to avoid pointlessly shitting in config