From: Tomas Doran Date: Thu, 4 Aug 2011 20:10:39 +0000 (+0100) Subject: Mass block comment on why I think we should pass the app in also.. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3f1b003225743b744cb5b587df51dbc88887fc93;p=catagits%2FCatalyst-Runtime.git Mass block comment on why I think we should pass the app in also.. --- diff --git a/lib/Catalyst/IOC/ConstructorInjection.pm b/lib/Catalyst/IOC/ConstructorInjection.pm index a37e5bd..72e1543 100644 --- a/lib/Catalyst/IOC/ConstructorInjection.pm +++ b/lib/Catalyst/IOC/ConstructorInjection.pm @@ -26,6 +26,11 @@ sub get { my $component = $self->class; my $params = $self->params; my $config = $params->{config}->{ $self->config_key } || {}; + # FIXME - Is depending on the application name to pass into constructors here a good idea? + # This makes app/ctx split harder I think.. Need to think more here, but I think + # we want to pass the application in as a parameter when building the service + # rather than depending on the app name, so that later, when the app becomes an instance + # then it'll get passed in, and components can stash themselves 'per app instance' my $app_name = $params->{application_name}; # Stash catalyst_component_name in the config here, so that custom COMPONENT diff --git a/lib/Catalyst/IOC/SubContainer.pm b/lib/Catalyst/IOC/SubContainer.pm index ccbf007..794e373 100644 --- a/lib/Catalyst/IOC/SubContainer.pm +++ b/lib/Catalyst/IOC/SubContainer.pm @@ -21,11 +21,14 @@ sub _build_default_componentt { sub get_component { - my ( $self, $name, @args ) = @_; + my ( $self, $name, $ctx, @args ) = @_; return $self->resolve( service => $name, - parameters => { accept_context_args => \@args }, + parameters => { + accept_context_args => [ $ctx, @args ], + ctx => $ctx, + }, ); }