From: André Walker Date: Mon, 1 Aug 2011 22:57:14 +0000 (-0300) Subject: suffix becomes config_key X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=9e6091e2f24701da88b4592f4192e6731faa4813 suffix becomes config_key --- diff --git a/lib/Catalyst/IOC/ConstructorInjection.pm b/lib/Catalyst/IOC/ConstructorInjection.pm index 6474fd5..25d7135 100644 --- a/lib/Catalyst/IOC/ConstructorInjection.pm +++ b/lib/Catalyst/IOC/ConstructorInjection.pm @@ -1,12 +1,23 @@ package Catalyst::IOC::ConstructorInjection; use Moose; +use Catalyst::Utils (); extends 'Bread::Board::ConstructorInjection'; with 'Bread::Board::Service::WithClass', 'Bread::Board::Service::WithDependencies', - 'Bread::Board::Service::WithParameters', + 'Catalyst::IOC::Service::WithParameters', 'Catalyst::IOC::Service::WithCOMPONENT'; +has config_key => ( + is => 'ro', + isa => 'Str', + lazy_build => 1, +); + +sub _build_config_key { + Catalyst::Utils::class2classsuffix( shift->class ); +} + # FIXME - how much of this should move to ::WithCOMPONENT? sub get { my $self = shift; @@ -14,7 +25,7 @@ sub get { my $constructor = $self->constructor_name; my $component = $self->class; my $params = $self->params; - my $config = $params->{config}->{ $self->param('suffix') } || {}; + my $config = $params->{config}->{ $self->config_key } || {}; my $app_name = $params->{application_name}; # Stash catalyst_component_name in the config here, so that custom COMPONENT