attempt at locate_components backcompat
André Walker [Thu, 28 Jul 2011 22:35:36 +0000 (19:35 -0300)]
lib/Catalyst.pm
lib/Catalyst/IOC/Container.pm

index 0cd35b0..b7a2c77 100644 (file)
@@ -2320,10 +2320,27 @@ sub setup_components {
     shift->container->setup_components();
 }
 
+=head2 locate_components
+
+=cut
+
 # FIXME - removed locate_components
 # don't people mess with this method directly?
 # what to do with that?
 
+sub locate_components {
+    my $class = shift;
+
+    $class->log->warn('The locate_components method has been deprecated.');
+    $class->log->warn('Please read Catalyst::IOC::Container documentation to');
+    $class->log->warn('update your application.');
+
+    # XXX think about ditching this sort entirely
+    return sort { length $a <=> length $b }
+        @{ $class->container->resolve( service => 'locate_components' ) };
+}
+
+
 =head2 $c->setup_dispatcher
 
 Sets up dispatcher.
index 396e756..85624a3 100644 (file)
@@ -396,10 +396,7 @@ sub build_locate_components_service {
                 %$config
             );
 
-            # XXX think about ditching this sort entirely
-            my @comps = sort { length $a <=> length $b } $locator->plugins;
-
-            return \@comps;
+            return [ $locator->plugins ];
         },
         dependencies => [ depends_on('application_name'), depends_on('config') ],
     );