use Hash::Util qw/lock_hash/;
use MooseX::Types::LoadableClass qw/ LoadableClass /;
use Moose::Util;
+use Scalar::Util qw/refaddr/;
use Catalyst::IOC::BlockInjection;
use Catalyst::IOC::ConstructorInjection;
use Module::Pluggable::Object ();
$self->add_sub_container(
$self->build_model_subcontainer( @default_model )
);
+
+ {
+ no strict 'refs';
+ no warnings 'once';
+ my $class = ref $self;
+ ${ $class . '::customise_container' }->($self)
+ if ${ $class . '::customise_container' };
+ }
}
sub build_model_subcontainer {
sub setup_components {
my $self = shift;
- warn("Setting up default components");
my $class = $self->resolve( service => 'application_name' );
my @comps = @{ $self->resolve( service => 'locate_components' ) };
my %comps = map { $_ => 1 } @comps;
my $deprecatedcatalyst_component_names = 0;
+ my $app_locate_components_addr = refaddr(
+ $class->can('locate_components')
+ );
+ my $cat_locate_components_addr = refaddr(
+ Catalyst->can('locate_components')
+ );
+
+ if ($app_locate_components_addr != $cat_locate_components_addr) {
+ # FIXME - why not just say: @comps = $class->locate_components() ?
+ $class->log->warn(qq{You have overridden locate_components. That } .
+ qq{no longer works. Please refer to the documentation to achieve } .
+ qq{similar results.\n}
+ );
+ }
+
for my $component ( @comps ) {
# We pass ignore_loaded here so that overlay files for (e.g.)
# FIXME - if we're getting from these containers, we need to either:
# - pass 'ctx' and 'accept_context_args' OR
# - make these params optional
+ # big problem when setting up the dispatcher - this method is called
+ # as $container->get_all_components('MyApp'). What to do with Request
+ # life cycles?
foreach my $type (qw/model view controller /) {
my $container = $self->get_sub_container($type);
=head1 METHODS
-=head1 Building Containers
+=head1 Methods for Building Containers
=head2 build_component_subcontainer
Same as L<build_model_subcontainer>, but for controllers.
-=head1 Building Services
+=head1 Methods for Building Services
=head2 build_application_name_service
=head2 setup_components
+Uses locate_components service to list the components, and adds them to the
+appropriate subcontainers, using add_component().
+
=head1 AUTHORS
Catalyst Contributors, see Catalyst.pm