From: Justin Hunter Date: Sun, 8 Aug 2010 15:21:42 +0000 (+0000) Subject: check if @expanded_components has any deprecated names X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=ad0f7a3b8ff866496d275bb9588fa3bab9e7c98b check if @expanded_components has any deprecated names --- diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 7c03083..dfd7863 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -2495,6 +2495,19 @@ sub setup_components { : $class->expand_component_module( $component, $config ); for my $component (@expanded_components) { next if $comps{$component}; + + $deprecatedcatalyst_component_names = grep { /::[CMV]::/ } @expanded_components; + $class->log->warn(qq{Your application is using the deprecated ::[MVC]:: type naming scheme.\n}. + qq{Please switch your class names to ::Model::, ::View:: and ::Controller: as appropriate.\n} + ) if $deprecatedcatalyst_component_names; + + if ($deprecatedcatalyst_component_names) { + $type = lc((split /::/, $component)[1]); + $type = 'controller' if $type eq 'c'; + $type = 'model' if $type eq 'm'; + $type = 'view' if $type eq 'v'; + } + $containers->{$type}->add_service(Bread::Board::BlockInjection->new( name => $component, block => sub { return $class->setup_component($component) } )); $class->components->{ $component } = $class->setup_component($component); } }