[Catalyst-commits] r13469 -
Catalyst-Runtime/5.80/branches/gsoc_breadboard/lib
arcanez at dev.catalyst.perl.org
arcanez at dev.catalyst.perl.org
Wed Aug 4 15:04:27 GMT 2010
Author: arcanez
Date: 2010-08-04 16:04:27 +0100 (Wed, 04 Aug 2010)
New Revision: 13469
Modified:
Catalyst-Runtime/5.80/branches/gsoc_breadboard/lib/Catalyst.pm
Log:
create sub-containers for m/v/c
Modified: Catalyst-Runtime/5.80/branches/gsoc_breadboard/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/gsoc_breadboard/lib/Catalyst.pm 2010-08-04 14:25:18 UTC (rev 13468)
+++ Catalyst-Runtime/5.80/branches/gsoc_breadboard/lib/Catalyst.pm 2010-08-04 15:04:27 UTC (rev 13469)
@@ -67,7 +67,7 @@
#I imagine that very few of these really need to be class variables. if any.
#maybe we should just make them attributes with a default?
__PACKAGE__->mk_classdata($_)
- for qw/components arguments dispatcher engine log dispatcher_class
+ for qw/container components arguments dispatcher engine log dispatcher_class
engine_class context_class request_class response_class stats_class
setup_finished/;
@@ -2399,7 +2399,12 @@
my $container_class = Class::MOP::load_first_existing_class(@container_classes);
- my $config = $container_class->new( %args, name => "$class" )->fetch('config')->get;
+ my $container = $container_class->new( %args, name => "$class" );
+
+ $container->add_sub_container(Bread::Board::Container->new( name => $_ )) for qw(model controller view);
+ $class->container($container);
+
+ my $config = $container->fetch('config')->get;
$class->config($config);
$class->finalize_config; # back-compat
}
@@ -2448,8 +2453,13 @@
Catalyst::Utils::ensure_class_loaded( $component, { ignore_loaded => 1 } );
}
+ my $containers;
+ $containers->{$_} = $class->container->get_sub_container($_) for qw(model view controller);
+
for my $component (@comps) {
my $instance = $class->components->{ $component } = $class->setup_component($component);
+ my $type = lc((split /::/, $component)[1]);
+ $containers->{$type}->add_service(Bread::Board::BlockInjection->new( name => $component, block => sub { return $instance } ));
my @expanded_components = $instance->can('expand_modules')
? $instance->expand_modules( $component, $config )
: $class->expand_component_module( $component, $config );
More information about the Catalyst-commits
mailing list