[Catalyst-commits] r13481 - Catalyst-Runtime/5.80/branches/gsoc_breadboard/lib

arcanez at dev.catalyst.perl.org arcanez at dev.catalyst.perl.org
Sun Aug 8 15:21:42 GMT 2010


Author: arcanez
Date: 2010-08-08 16:21:42 +0100 (Sun, 08 Aug 2010)
New Revision: 13481

Modified:
   Catalyst-Runtime/5.80/branches/gsoc_breadboard/lib/Catalyst.pm
Log:
check if @expanded_components has any deprecated names

Modified: Catalyst-Runtime/5.80/branches/gsoc_breadboard/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/gsoc_breadboard/lib/Catalyst.pm	2010-08-06 18:38:47 UTC (rev 13480)
+++ Catalyst-Runtime/5.80/branches/gsoc_breadboard/lib/Catalyst.pm	2010-08-08 15:21:42 UTC (rev 13481)
@@ -2471,6 +2471,19 @@
             : $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);
         }
     }




More information about the Catalyst-commits mailing list