my %config = (%{ $self->config || {} }, %{ $params });
$self->_clear_config;
- # FIXME - Is depending on the application name to pass into constructors here a good idea?
- # This makes app/ctx split harder I think.. Need to think more here, but I think
- # we want to pass the application in as a parameter when building the service
- # rather than depending on the app name, so that later, when the app becomes an instance
- # then it'll get passed in, and components can stash themselves 'per app instance'
- my $app_name = $self->param('application_name');
+ my $app = $self->param('catalyst_application');
# Stash catalyst_component_name in the config here, so that custom COMPONENT
# methods also pass it.
my $instance;
try {
- $instance = $component->COMPONENT( $app_name, \%config );
+ $instance = $component->COMPONENT( $app, \%config );
}
catch {
Catalyst::Exception->throw(
substitutions
file
driver
- application_name
+ catalyst_application
prefix
extensions
path
name => 'home',
block => sub {
my $self = shift;
- my $class = $self->param('application_name');
+ my $class = $self->param('catalyst_application');
my $home;
if ( my $env = Catalyst::Utils::env_value( $class, 'HOME' ) ) {
$home ||= Catalyst::Utils::home($class);
return $home;
},
- dependencies => [ depends_on('application_name') ],
+ dependencies => [ depends_on('catalyst_application') ],
);
}
);
}
-sub build_application_name_service {
+sub build_catalyst_application_service {
my $self = shift;
- return Bread::Board::Literal->new( name => 'application_name', value => $self->name );
+ return Bread::Board::Literal->new( name => 'catalyst_application', value => $self->name );
}
sub build_driver_service {
lifecycle => 'Singleton',
name => 'prefix',
block => sub {
- return Catalyst::Utils::appprefix( shift->param('application_name') );
+ return Catalyst::Utils::appprefix( shift->param('catalyst_application') );
},
- dependencies => [ depends_on('application_name') ],
+ dependencies => [ depends_on('catalyst_application') ],
);
}
block => sub {
my $s = shift;
- return Catalyst::Utils::env_value( $s->param('application_name'), 'CONFIG' )
+ return Catalyst::Utils::env_value( $s->param('catalyst_application'), 'CONFIG' )
|| $s->param('file')
- || $s->param('application_name')->path_to( $s->param('prefix') );
+ || $s->param('catalyst_application')->path_to( $s->param('prefix') );
},
- dependencies => [ depends_on('file'), depends_on('application_name'), depends_on('prefix') ],
+ dependencies => [ depends_on('file'), depends_on('catalyst_application'), depends_on('prefix') ],
);
}
my $v = Data::Visitor::Callback->new(
plain_value => sub {
return unless defined $_;
- return $self->_config_substitutions( $s->param('application_name'), $s->param('substitutions'), $_ );
+ return $self->_config_substitutions( $s->param('catalyst_application'), $s->param('substitutions'), $_ );
}
);
$v->visit( $s->param('raw_config') );
},
- dependencies => [ depends_on('application_name'), depends_on('raw_config'), depends_on('substitutions') ],
+ dependencies => [ depends_on('catalyst_application'), depends_on('raw_config'), depends_on('substitutions') ],
);
}
name => 'class_config',
block => sub {
my $s = shift;
- my $app = $s->param('application_name');
+ my $app = $s->param('catalyst_application');
# Container might be called outside Catalyst context
return {} unless Class::MOP::is_class_loaded($app);
# config might not have been defined
return $app->config || {};
},
- dependencies => [ depends_on('application_name') ],
+ dependencies => [ depends_on('catalyst_application') ],
);
}
name => 'config_local_suffix',
block => sub {
my $s = shift;
- my $suffix = Catalyst::Utils::env_value( $s->param('application_name'), 'CONFIG_LOCAL_SUFFIX' ) || $self->config_local_suffix;
+ my $suffix = Catalyst::Utils::env_value( $s->param('catalyst_application'), 'CONFIG_LOCAL_SUFFIX' ) || $self->config_local_suffix;
return $suffix;
},
- dependencies => [ depends_on('application_name') ],
+ dependencies => [ depends_on('catalyst_application') ],
);
}
name => 'locate_components',
block => sub {
my $s = shift;
- my $class = $s->param('application_name');
+ my $class = $s->param('catalyst_application');
my $config = $s->param('config')->{ setup_components };
Catalyst::Exception->throw(
return [ $locator->plugins ];
},
- dependencies => [ depends_on('application_name'), depends_on('config') ],
+ dependencies => [ depends_on('catalyst_application'), depends_on('config') ],
);
}
sub setup_components {
my $self = shift;
- my $class = $self->resolve( service => 'application_name' );
+ my $class = $self->resolve( service => 'catalyst_application' );
my @comps = @{ $self->resolve( service => 'locate_components' ) };
my %comps = map { $_ => 1 } @comps;
my $deprecatedcatalyst_component_names = 0;
class => $component,
lifecycle => 'Singleton',
dependencies => [
- depends_on( '/application_name' ),
+ depends_on( '/catalyst_application' ),
],
),
);
=head1 Methods for Building Services
-=head2 build_application_name_service
+=head2 build_catalyst_application_service
Name of the application (such as MyApp).
class => 'TestAppCustomContainer::Model::SingletonLifeCycle',
catalyst_component_name => 'TestAppCustomContainer::Model::SingletonLifeCycle',
dependencies => {
- application_name => depends_on( '/application_name' ),
+ catalyst_application => depends_on( '/catalyst_application' ),
},
)
);
class => 'TestAppCustomContainer::Model::RequestLifeCycle',
catalyst_component_name => 'TestAppCustomContainer::Model::RequestLifeCycle',
dependencies => {
- application_name => depends_on( '/application_name' ),
+ catalyst_application => depends_on( '/catalyst_application' ),
},
)
);
# class => 'TestAppCustomContainer::Model::DependsOnDefaultSetup',
# catalyst_component_name => 'TestAppCustomContainer::Model::DependsOnDefaultSetup',
# dependencies => {
-# application_name => depends_on( '/application_name' ),
+# catalyst_application => depends_on( '/catalyst_application' ),
# # FIXME - this is what is blowing up everything:
# # DefaultSetup needs the context. It's not getting it here!
# foo => depends_on('/model/DefaultSetup'),
# lifecycle => 'Singleton',
# class => 'TestAppCustomContainer::External::Class',
# dependencies => [
-# depends_on( '/application_name' ),
+# depends_on( '/catalyst_application' ),
# ],
# config => $fnar_config,
# )