use Catalyst::Controller;
use Data::OptList;
use File::stat;
-use Module::Pluggable::Object ();
use Text::SimpleTable ();
use Path::Class::Dir ();
use Path::Class::File ();
sub setup_components {
my $class = shift;
+ my $container = $class->container;
my $config = $class->config->{ setup_components };
qq{other ways of achieving the same results.\n}
) if delete $config->{ search_extra };
- my @comps = $class->locate_components($config);
+ my @comps = $container->locate_components($class, $config);
my %comps = map { $_ => 1 } @comps;
my $deprecatedcatalyst_component_names = grep { /::[CMV]::/ } @comps;
Catalyst::Utils::ensure_class_loaded( $component, { ignore_loaded => 1 } );
}
- my $container = $class->container;
-
for my $component (@comps) {
$container->add_component( $component, $class );
# FIXME - $instance->expand_modules() is broken
$container->get_sub_container('view')->make_single_default;
}
-
-=head2 $c->locate_components( $setup_component_config )
-
-This method is meant to provide a list of component modules that should be
-setup for the application. By default, it will use L<Module::Pluggable>.
-
-Specify a C<setup_components> config option to pass additional options directly
-to L<Module::Pluggable>.
-
-=cut
-
-sub locate_components {
- my $class = shift;
- my $config = shift;
-
- my @paths = qw( ::Controller ::C ::Model ::M ::View ::V );
-
- my $locator = Module::Pluggable::Object->new(
- search_path => [ map { s/^(?=::)/$class/; $_; } @paths ],
- %$config
- );
-
- # XXX think about ditching this sort entirely
- my @comps = sort { length $a <=> length $b } $locator->plugins;
-
- return @comps;
-}
+# FIXME - removed locate_components
+# don't people mess with this method directly?
+# what to do with that?
=head2 $c->setup_dispatcher
use MooseX::Types::LoadableClass qw/ LoadableClass /;
use Moose::Util;
use Catalyst::IOC::BlockInjection;
+use Module::Pluggable::Object ();
use namespace::autoclean;
extends 'Bread::Board::Container';
return Devel::InnerPackage::list_packages( $module );
}
+sub locate_components {
+ my ( $self, $class, $config ) = @_;
+
+ my @paths = qw( ::Controller ::C ::Model ::M ::View ::V );
+
+ my $locator = Module::Pluggable::Object->new(
+ search_path => [ map { s/^(?=::)/$class/; $_; } @paths ],
+ %$config
+ );
+
+ # XXX think about ditching this sort entirely
+ my @comps = sort { length $a <=> length $b } $locator->plugins;
+
+ return @comps;
+}
+
1;
__END__
Components found by C<locate_components> will be passed to this method, which
is expected to return a list of component (package) names to be set up.
-=cut
+=head2 locate_components( $setup_component_config )
+
+This method is meant to provide a list of component modules that should be
+setup for the application. By default, it will use L<Module::Pluggable>.
+
+Specify a C<setup_components> config option to pass additional options directly
+to L<Module::Pluggable>.
=head1 AUTHORS